S100 OpenExplorer

# #hbDNNTensorProperties

`typedef struct { hbDNNTensorShape validShape; int32_t tensorType; hbDNNQuantiScale scale; hbDNNQuantiType quantiType; int32_t quantizeAxis; int64_t alignedByteSize; int64_t stride[HB_DNN_TENSOR_MAX_DIMENSIONS]; } hbDNNTensorProperties;`

Tensor information.

- Member

Member Name | Description
--- | ---
`validShape` | Shape of the valid content of the tensor.
`tensorType` | Tensor type.
`scale` | Scale of quantization.
`quantiType` | Quantization type.
`quantizeAxis` | Index of the quantization axis, effective only when quantified by per-axis.
`alignedByteSize` | Memory size of the aligned content of the tensor.
`stride` | Step size of each dimension of validShape, measured in Bytes.

Note

If some dimensions in the `validShape` field are `-1`, it means that the `validShape` of the model is a dynamic input in this dimension, and you need to fill it in according to the actual input before creating a task.

The `quantizeAxis` represents the dimension of the quantization axis index and is only effective during `per-axis` quantization. When the data is quantized with `per-tensor`, `quantizeAxis` is negative.

The tensor information obtained through the interface is required by the model, you can modify the corresponding tensor information according to the actual input, at present, you are only allowed to modify the information of `stride` and `tensorType`, and must meet the requirements.

`stride`:

1. If you prepare your input based on `stride`, you do not need to modify the `stride`.

2. If you prepare your input based on `validShape`, you need to modify the value of `stride` to be the step size of the jumps in each dimension of `validShape`, and the inference library will internally padding the data.

3. If some dimensions of the `stride` obtained from the model are `-1`, it means that the `stride` of the model is a dynamic input in this dimension, and you need to fill it in according to the actual input before creating a task. For the constraints of filling in, please refer to the Dynamic Input Introduction section.

The `alignedByteSize` represents the size of the memory space occupied in the tensor, which can generally be used to apply for input and output memory.

On This Page