Skip to main content

TensorSpec

One input or output slot of a graph: its name, dtype and dims. A dims entry of -1 (TensorSpec.kDynamicDim) is dynamic; a dim_names entry names a dynamic dim so slots sharing the name share the size.

dim_names (property)​

Optional per-dim labels aligned with dims; empty when unnamed.

dims (property)​

Per-dim sizes; -1 marks a dynamic dim.

dtype (property)​

The element dtype (clika_runtime.float32 and kin); assignable from a dtype object or its name.

is_dynamic (property)​

True when any dim is dynamic.

kDynamicDim (property)​

(arg: object, /) -> int

name (property)​

The slot name, the binding key.

optional (property)​

True when the slot may be absent in a request.

__init__​

__init____init__(self) -> None

init(self) -> None init(self, name: str, dtype: object, dims: collections.abc.Sequence[int], optional: bool = False, dim_names: collections.abc.Sequence[str] = []) -> None

Overloaded function.

  1. __init__(self) -> None

  2. __init__(self, name: str, dtype: object, dims: collections.abc.Sequence[int], optional: bool = False, dim_names: collections.abc.Sequence[str] = []) -> None

TensorSpec(name, dtype, dims, optional=False, dim_names=())

An input/output slot: dims entries of -1 are dynamic; a dim_names entry names a dynamic dim so slots sharing the name share the size. dtype is a dtype object (clika_runtime.float32) or its name.

dim_is_dynamic​

dim_is_dynamicdim_is_dynamic(self, i: int) -> bool

dim_is_dynamic(self, i: int) -> bool

dim_is_dynamic(i) -> bool

Whether dim i is dynamic (False past the rank).

dim_name​

dim_namedim_name(self, i: int) -> str

dim_name(self, i: int) -> str

dim_name(i) -> str

The label of dim i, or '' when unnamed.

from_tensor​

from_tensor(*args, **kwargs)

from_tensor(tensor: clika_runtime._core.Tensor, name: str = '') -> clika_runtime._core.TensorSpec

from_tensor(tensor, name='') -> TensorSpec

The slot a tensor fills: its dtype and its dims as fixed sizes (waits for a pending shape).

from_tensors​

from_tensors(*args, **kwargs)

from_tensors(tensors: collections.abc.Sequence[clika_runtime._core.Tensor]) -> list[clika_runtime._core.TensorSpec]

from_tensors(tensors) -> list[TensorSpec]

One slot per tensor, in order, each named positionally.