20 KiB
module concrete.fhe.tracing.tracer
Declaration of Tracer class.
class Tracer
Tracer class, to create computation graphs from python functions.
method __init__
__init__(computation: Node, input_tracers: List[ForwardRef('Tracer')])
property T
Trace numpy.ndarray.T.
property ndim
Trace numpy.ndarray.ndim.
property shape
Trace numpy.ndarray.shape.
property size
Trace numpy.ndarray.size.
method astype
astype(
dtype: Union[dtype[Any], NoneType, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any], Type[ForwardRef('ScalarAnnotation')]]
) → Tracer
Trace numpy.ndarray.astype(dtype).
method clip
clip(minimum: Any, maximum: Any) → Tracer
Trace numpy.ndarray.clip().
method dot
dot(other: Any) → Tracer
Trace numpy.ndarray.dot().
method flatten
flatten() → Tracer
Trace numpy.ndarray.flatten().
method reshape
reshape(*newshape: Union[Any, Tuple[Any, ]]) → Tracer
Trace numpy.ndarray.reshape(newshape).
method round
round(decimals: int = 0) → Tracer
Trace numpy.ndarray.round().
method sanitize
sanitize(value: Any) → Any
Try to create a tracer from a value.
Args: value (Any): value to use
Returns: Any: resulting tracer
method trace
trace(
function: Callable,
parameters: Dict[str, ValueDescription],
is_direct: bool = False,
name: str = 'main'
) → Graph
Trace function and create the Graph that represents it.
Args: function (Callable): function to trace
parameters (Dict[str, ValueDescription]): parameters of function to trace e.g. parameter x is an EncryptedScalar holding a 7-bit UnsignedInteger
is_direct (bool, default = False): whether the tracing is done on actual parameters or placeholders
name (str, default = "main"): the name of the function being traced
Returns:
Graph: computation graph corresponding to function
method transpose
transpose(axes: Optional[Tuple[int, ]] = None) → Tracer
Trace numpy.ndarray.transpose().
class Annotation
Base annotation for direct definition.
method __init__
__init__(computation: Node, input_tracers: List[ForwardRef('Tracer')])
property T
Trace numpy.ndarray.T.
property ndim
Trace numpy.ndarray.ndim.
property shape
Trace numpy.ndarray.shape.
property size
Trace numpy.ndarray.size.
method astype
astype(
dtype: Union[dtype[Any], NoneType, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any], Type[ForwardRef('ScalarAnnotation')]]
) → Tracer
Trace numpy.ndarray.astype(dtype).
method clip
clip(minimum: Any, maximum: Any) → Tracer
Trace numpy.ndarray.clip().
method dot
dot(other: Any) → Tracer
Trace numpy.ndarray.dot().
method flatten
flatten() → Tracer
Trace numpy.ndarray.flatten().
method reshape
reshape(*newshape: Union[Any, Tuple[Any, ]]) → Tracer
Trace numpy.ndarray.reshape(newshape).
method round
round(decimals: int = 0) → Tracer
Trace numpy.ndarray.round().
method sanitize
sanitize(value: Any) → Any
Try to create a tracer from a value.
Args: value (Any): value to use
Returns: Any: resulting tracer
method trace
trace(
function: Callable,
parameters: Dict[str, ValueDescription],
is_direct: bool = False,
name: str = 'main'
) → Graph
Trace function and create the Graph that represents it.
Args: function (Callable): function to trace
parameters (Dict[str, ValueDescription]): parameters of function to trace e.g. parameter x is an EncryptedScalar holding a 7-bit UnsignedInteger
is_direct (bool, default = False): whether the tracing is done on actual parameters or placeholders
name (str, default = "main"): the name of the function being traced
Returns:
Graph: computation graph corresponding to function
method transpose
transpose(axes: Optional[Tuple[int, ]] = None) → Tracer
Trace numpy.ndarray.transpose().
class ScalarAnnotation
Base scalar annotation for direct definition.
method __init__
__init__(computation: Node, input_tracers: List[ForwardRef('Tracer')])
property T
Trace numpy.ndarray.T.
property ndim
Trace numpy.ndarray.ndim.
property shape
Trace numpy.ndarray.shape.
property size
Trace numpy.ndarray.size.
method astype
astype(
dtype: Union[dtype[Any], NoneType, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any], Type[ForwardRef('ScalarAnnotation')]]
) → Tracer
Trace numpy.ndarray.astype(dtype).
method clip
clip(minimum: Any, maximum: Any) → Tracer
Trace numpy.ndarray.clip().
method dot
dot(other: Any) → Tracer
Trace numpy.ndarray.dot().
method flatten
flatten() → Tracer
Trace numpy.ndarray.flatten().
method reshape
reshape(*newshape: Union[Any, Tuple[Any, ]]) → Tracer
Trace numpy.ndarray.reshape(newshape).
method round
round(decimals: int = 0) → Tracer
Trace numpy.ndarray.round().
method sanitize
sanitize(value: Any) → Any
Try to create a tracer from a value.
Args: value (Any): value to use
Returns: Any: resulting tracer
method trace
trace(
function: Callable,
parameters: Dict[str, ValueDescription],
is_direct: bool = False,
name: str = 'main'
) → Graph
Trace function and create the Graph that represents it.
Args: function (Callable): function to trace
parameters (Dict[str, ValueDescription]): parameters of function to trace e.g. parameter x is an EncryptedScalar holding a 7-bit UnsignedInteger
is_direct (bool, default = False): whether the tracing is done on actual parameters or placeholders
name (str, default = "main"): the name of the function being traced
Returns:
Graph: computation graph corresponding to function
method transpose
transpose(axes: Optional[Tuple[int, ]] = None) → Tracer
Trace numpy.ndarray.transpose().
class TensorAnnotation
Base tensor annotation for direct definition.
method __init__
__init__(computation: Node, input_tracers: List[ForwardRef('Tracer')])
property T
Trace numpy.ndarray.T.
property ndim
Trace numpy.ndarray.ndim.
property shape
Trace numpy.ndarray.shape.
property size
Trace numpy.ndarray.size.
method astype
astype(
dtype: Union[dtype[Any], NoneType, type[Any], _SupportsDType[dtype[Any]], str, tuple[Any, int], tuple[Any, Union[SupportsIndex, Sequence[SupportsIndex]]], list[Any], _DTypeDict, tuple[Any, Any], Type[ForwardRef('ScalarAnnotation')]]
) → Tracer
Trace numpy.ndarray.astype(dtype).
method clip
clip(minimum: Any, maximum: Any) → Tracer
Trace numpy.ndarray.clip().
method dot
dot(other: Any) → Tracer
Trace numpy.ndarray.dot().
method flatten
flatten() → Tracer
Trace numpy.ndarray.flatten().
method reshape
reshape(*newshape: Union[Any, Tuple[Any, ]]) → Tracer
Trace numpy.ndarray.reshape(newshape).
method round
round(decimals: int = 0) → Tracer
Trace numpy.ndarray.round().
method sanitize
sanitize(value: Any) → Any
Try to create a tracer from a value.
Args: value (Any): value to use
Returns: Any: resulting tracer
method trace
trace(
function: Callable,
parameters: Dict[str, ValueDescription],
is_direct: bool = False,
name: str = 'main'
) → Graph
Trace function and create the Graph that represents it.
Args: function (Callable): function to trace
parameters (Dict[str, ValueDescription]): parameters of function to trace e.g. parameter x is an EncryptedScalar holding a 7-bit UnsignedInteger
is_direct (bool, default = False): whether the tracing is done on actual parameters or placeholders
name (str, default = "main"): the name of the function being traced
Returns:
Graph: computation graph corresponding to function
method transpose
transpose(axes: Optional[Tuple[int, ]] = None) → Tracer
Trace numpy.ndarray.transpose().