Data Structures¶
Module: polygraphy.common
-
class
TensorMetadata(dct=None)[source]¶ Bases:
polygraphy.common.interface.InterfaceAn OrderedDict[str, MetadataTuple] that maps input names to their data types and shapes.
Shapes may include negative values,
None, or strings to indicate dynamic dimensions.Example:
shape = tensor_meta["input0"].shape dtype = tensor_meta["input0"].dtype
-
static
from_feed_dict(feed_dict)[source]¶ Constructs a new TensorMetadata using information from the provided feed_dict.
- Parameters
feed_dict (OrderedDict[str, numpy.ndarray]) – A mapping of input tensor names to corresponding input NumPy arrays.
- Returns
TensorMetadata
-
add(name, dtype, shape)[source]¶ Convenience function for adding entries.
- Parameters
name (str) – The name of the input.
dtype (numpy.dtype) – The data type of the input.
shape (Sequence[Union[int, str]]]) – The shape of the input. Dynamic dimensions may be indicated by negative values,
None, or a string.
- Returns
The newly added entry.
-
static