Function: get_desc_from_file

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 model description based on the model file.

Prototype

  • C Prototype
    1
    aclError aclmdlGetDescFromFile(aclmdlDesc *modelDesc, const char *modelPath)
    
  • Python Function
    1
    ret = acl.mdl.get_desc_from_file(model_desc, model_path)
    

Parameter Description

Parameter

Description

model_desc

Int, pointer to data of the aclmdlDesc type. Call create_desc to create data of the aclmdlDesc type in advance.

After the call is successful, the content in the pointer address is updated.

model_path

Str, directory of an offline model file, including the file name. The user who runs the app must have enough permission to access the directory.

The offline model file is an offline model (.om file) adapted to the Ascend AI Processor.

NOTE:
  • For details about how to obtain the .om file, see Model Building.
  • When you use ATC to generate an .om file, set --external_weight to 1, indicating that the weight of the Const/Constant node on the original network is saved in a separate file in the weight directory. Ensure that the weight directory is at the same level as the .om file so that it can search for the weight file in the weight directory when you call this API to load the .om file. If the weight directory is not correctly placed, the weight file may fail to be loaded.

Return Value Description

Return Value

Description

ret

Int, 0 on success; else, failure.

Restrictions

The model description obtained using this API cannot be used for the get_op_attr and get_cur_output_dims APIs.