pub struct TensorAttr {
pub index: u32,
pub shape: Vec<u32>,
pub n_elems: u32,
pub size: u32,
pub size_with_stride: u32,
pub format: TensorFormat,
pub data_type: TensorType,
pub qnt_type: QuantType,
pub zp: i32,
pub scale: f32,
pub name: String,
}Expand description
Metadata for a single tensor (input or output).
Contains everything you need to interpret the tensor data: shape, memory layout, data type, and quantization parameters.
§Quantization fields
zp(zero-point) andscaleare used for INT8 affine dequantization:f32_value = (raw_i8 - zp) * scale- These are set during model conversion and are different for each tensor.
§Shape
For NC1HWC2 outputs (common on RV1106), the shape is [1, c1, H, W, c2].
For NHWC inputs, the shape is [1, H, W, C].
Fields§
§index: u32Tensor index (0 for first input/output, 1 for second, etc.).
shape: Vec<u32>Tensor dimensions. See TensorFormat for how to interpret them.
n_elems: u32Total number of elements in the tensor.
size: u32Size in bytes.
size_with_stride: u32Size in bytes including stride padding (used for memory allocation).
format: TensorFormatMemory layout of the tensor data.
data_type: TensorTypeElement data type.
qnt_type: QuantTypeQuantization method.
zp: i32Quantization zero-point (for affine dequantization).
scale: f32Quantization scale (for affine dequantization).
name: StringHuman-readable tensor name from the model.
Trait Implementations§
Source§impl Clone for TensorAttr
impl Clone for TensorAttr
Source§fn clone(&self) -> TensorAttr
fn clone(&self) -> TensorAttr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TensorAttr
impl Debug for TensorAttr
Source§impl From<&RknnTensorAttr> for TensorAttr
Implements From for TensorAttr
impl From<&RknnTensorAttr> for TensorAttr
Implements From for TensorAttr