Function: get_input_size_by_index

Applicability

Product

Supported (√/x)

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

Atlas inference products

Atlas 200I/500 A2 inference products

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)
    

Parameter Description

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.

Return Value Description

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.