Function: create_data_buffer

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

Description

Creates data of the aclDataBuffer type to describe the memory address and size.

To destroy data of the aclDataBuffer type, call Function: destroy_data_buffer.

Prototype

  • C Prototype
    1
    aclDataBuffer *aclCreateDataBuffer(void *data, size_t size)
    
  • Python Function
    1
    output = acl.create_data_buffer(data, size)
    

Parameters

Parameter

Description

data

Int, pointer address of aclDataBuffer data. data can be set to 0, indicating that an empty data type is created. In this case, the value of size must be set to 0.

The memory needs to be managed by the user. Call the acl.rt.malloc or acl.rt.free API to apply for or release the memory, or call the acl.rt.malloc_host or acl.rt.free_host API to apply for or release the memory.

size

Int, memory size. If you need to use an empty tensor, set the minimum memory size to 1 byte during memory allocation to ensure normal running of subsequent services.

Return Value

Return Value

Description

output

Int, pointer address of the output aclDataBuffer.