StringTensor¶

class onnx_ir.StringTensor(value: Sequence[bytes] | npt.NDArray[np.bytes_], *, shape: Shape | None = None, name: str | None = None, doc_string: str | None = None, metadata_props: dict[str, str] | None = None)¶

Multidimensional array of strings (as binary data to match the string_data field in TensorProto).

display(*, page: bool = False) None¶

Pretty print the object.

Parameters:

page – Whether to page the output.

property doc_string: str | None¶

The documentation string.

property dtype: DataType¶

The data type of the tensor. Immutable.

property meta: MetadataStore¶

The metadata store for intermediate analysis.

Write to the metadata_props if you would like the metadata to be serialized to the ONNX proto.

property metadata_props: dict[str, str]¶
property name: str | None¶

The name of the tensor.

property nbytes: int¶

The number of bytes in the tensor.

numpy() npt.NDArray[np.bytes_][source]¶

Return the tensor as a numpy array.

property raw: Sequence[bytes] | npt.NDArray[np.bytes_]¶

Backing data of the tensor. Immutable.

property shape: Shape¶

The shape of the tensor. Immutable.

property size: int¶

The number of elements in the tensor.

string_data() Sequence[bytes][source]¶

Return the string data of the tensor.

tobytes() bytes[source]¶

Return the tensor as a byte string conformed to the ONNX specification, in little endian.