pub struct Tensor {
pub dimensions: Dimensions,
pub value_types: ValueTypes,
pub flags: u8,
pub data: Vec<u8>,
}Expand description
The tensor’s dimensions and type are provided as metadata to a model. Any metadata shall be associated to the respective model in a blob store.
Fields§
§dimensions: DimensionsTensor Dimensions The Dimension array contains one size value for each dimension of the Tensor
value_types: ValueTypesThe types array contains either: a single ValueType
that represents the data values for all dimensions (homogeneous array)
or one ValueType per dimension. In other words, the length
of this array is either 1 or the length of dimensions.
flags: u8Optional bit flags representing the data representation in the Tensor. Currently only one bit (LSB) is used to indicate row-major order (0) or column-major order (1).
data: Vec<u8>The Tensor
Implementations§
Source§impl Tensor
impl Tensor
Sourcepub fn set_row_major(&mut self)
pub fn set_row_major(&mut self)
Sets the tensor flag to indicate row-major order Setting this flag does not alter the data array
Sourcepub fn is_row_major(&self) -> bool
pub fn is_row_major(&self) -> bool
Returns true if the tensor is row-major order (based on flags setting)
Sourcepub fn set_column_major(&mut self)
pub fn set_column_major(&mut self)
Sets the tensor flag to indicate column-major order Setting this flag does not alter the data array
Sourcepub fn is_column_major(&self) -> bool
pub fn is_column_major(&self) -> bool
Returns true if the tensor is column-major order (based on flags setting)
Sourcepub fn set_little_endian(&mut self)
pub fn set_little_endian(&mut self)
Sets the tensor flag to indicate data is in big endian format
Sourcepub fn is_little_endian(&self) -> bool
pub fn is_little_endian(&self) -> bool
Returns true if the tensor flags indicate that data is little endian
Sourcepub fn set_big_endian(&mut self)
pub fn set_big_endian(&mut self)
Sets the tensor flag to indicate data is in big endian format
Sourcepub fn is_big_endian(&self) -> bool
pub fn is_big_endian(&self) -> bool
Returns true if the tensor flags indicate that data is big endian
Sourcepub fn check_dims(&self) -> Result<(), String>
pub fn check_dims(&self) -> Result<(), String>
perform validation checking on dimensions