Function: binary_load_from_data

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

Loads and parses the AI CPU operator binary data from the memory, copies the data to the device corresponding to the current context, and outputs the binHandle that points to the data.

When calling this API to load an AI CPU operator (option_type in aclrtBinaryLoadOptions contains ACL_RT_BINARY_LOAD_OPT_CPU_KERNEL_MODE), call acl.rt.register_cpu_func to register the operator.

Prototype

  • C Prototype
    1
    aclError aclrtBinaryLoadFromData(const void *data, size_t length, const aclrtBinaryLoadOptions *options, aclrtBinHandle *binHandle)
    
  • Python Function
    1
    bin_handle, ret = acl.rt.binary_load_from_data(mem_addr, length, options)
    

Parameter Description

Parameter

Description

mem_addr

Int, address of the host memory for storing the operator binary data. The value cannot be null.

length

Int, memory size of the operator binary data, in bytes. The value must be greater than 0.

options

List, optional options for loading the operator binary file. For details about the structure, see aclrtBinaryLoadOptions. If the options are empty, set options to [].

Return Value Description

Return Value

Description

bin_handle

Int, handle of the operator binary file.

ret

Int, 0 on success; else, failure.