Function: get_input_size_by_index

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Function Usage

Obtains the input size in bytes based on data of the aclmdlDesc type.

Prototype

  • C Prototype
    1
    size_t aclmdlGetInputSizeByIndex(aclmdlDesc *modelDesc, size_t index)
    
  • Python Function
    1
    size = acl.mdl.get_input_size_by_index(model_desc, index)
    

Parameters

Parameter

Description

model_desc

Int, pointer address of the data of the aclmdlDesc type.

Call acl.mdl.create_desc to create data of the aclmdlDesc type in advance.

index

Int, sequence number of the input to be obtained, starting from 0.

Returns

Return Value

Description

size

Int, size of the input, in bytes

  • If dynamic batch/image size (width and height) is enabled, the input size of the maximum profile is returned.
  • In other (static) cases, the size of the specified input is returned. The unit is byte.

Restrictions

If the shape input by the model is dynamic and the value of the dimension is –1 (indicating that any value greater than or equal to 1 can be used for the dimension), the size obtained from this call is 0. You need to allocate the memory based on the size of the memory occupied.