Updated on 2022-03-13 GMT+08:00

AIModelManager::GetModelIOTensorDim

Obtains the input and output dimensions of the loaded model.

Syntax

virtual AIStatus AIModelManager::GetModelIOTensorDim(const std::string& model_name, std::vector<TensorDimension>& input_tensor, std::vector<TensorDimension>& output_tensor) ;

Parameter Description

Parameter

Description

Value Range

model_name

Model name

-

input_tensor

List of input dimensions for a model

For details about the syntax of the TensorDimension data type, see TensorDimension.

-

output_tensor

List of output dimensions for a model

For details about the syntax of the TensorDimension data type, see TensorDimension.

-

Return Value

SUCCESS indicates that initialization succeeds, while FAILED indicates that initialization fails.

Example

The input and output tensors of the ResNet-50 model are described as follows.

If size of output_tensor is not 0, the obtained output_tensor data is appended to the original output_tensor data.

input_tensor
{
name = "data"                 # Name of the input layer
data_type = 0                # Reserved data type, which is not used currently
size = 20                     # Memory size, in bytes
format = 0                   # Reserved tensor format, which is not used currently
dims = {1,3,224,224}
}
output_tensor
{
name =  "output_0_prob_0"     # Name of the output tensor. The format is as follows: output_{digit}_{name of the output node}_{index of the output node}
data_type = 0                # Reserved data type, which is not used currently
size = 20                     # Memory size, in bytes
format = 0                   # Reserved tensor format, which is not used currently
dims = {1,1000,1,1}
}