TensorProtocol¶
- class onnx_ir.TensorProtocol(*args, **kwargs)¶
Concrete tensor backed by data.
The protocol does not specify how the data is stored. That data is exposed through the
rawattribute for examination, but accessingrawis typically not needed.To use the tensor as a numpy array, call
numpy(). To convert the tensor to a byte string for serialization, calltobytes().It is recommended to check the size of the tensor first before accessing the underlying data, because accessing the data may be expensive and incur IO overhead.
- shape¶
The shape of the tensor.
- Type:
ShapeProtocol
- dtype¶
The data type of the elements of the tensor. It is an
ir.DataTypeenum.- Type:
_enums.DataType
- raw¶
The raw data behind this tensor. It can be anything.
- Type:
Any