Function: create_data_buffer

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

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

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 allocate or release the memory, or call the acl.rt.malloc_host or acl.rt.free_host API to allocate 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 Values

Return Value

Description

output

Int, pointer address of the output aclDataBuffer.