Function: get_op_attr

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 attribute value of an operator in a model on the network.

Prototype

  • C Prototype
    1
    const char *aclmdlGetOpAttr(aclmdlDesc *modelDesc, const char *opName, const char *attr)
    
  • Python Function
    1
    attr_value = acl.mdl.get_op_attr(model_desc, op_name, attr)
    

Parameter Description

Parameter

Description

model_desc

Int, pointer address of the aclmdlDesc type.

Call acl.mdl.create_desc to create data of the aclmdlDesc type in advance, and then call acl.mdl.get_desc to obtain the data of the aclmdlDesc type based on the model ID.

op_name

Str, operator name.

attr

Str, operator attribute.

Currently, only the _datadump_original_op_names attribute is supported, which records the base operators before fusion. The API return is formatted as [opName1_len]opName1...[opNameN_len]opNameN, where opNameN_len indicates the length of the operator name string.

In the following example of the _datadump_original_op_names attribute, the base operators are scale2c_branch2c, bn2c_branch2c, res2c_branch2c, res2c, and res2c_relu and the lengths of the operator name strings are 16, 13, 14, 5, and 10.

[16]scale2c_branch2c[13]bn2c_branch2c[14]res2c_branch2c[5]res2c[10]res2c_relu

Return Value Description

Return Value

Description

attr_value

Str, attribute value. If the opName or attr attribute does not exist, or the attr attribute value is empty, an empty string is returned.

Failure: None.