Function: create_data_buffer

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

Creates data of the aclDataBuffer type to describe the buffer 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)
    

Parameter Description

Parameter

Description

data

Int, pointer address for storing data of the aclDataBuffer type. 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 users. You can call acl.rt.malloc/acl.rt.free or acl.rt.malloc_host/acl.rt.free_host to allocate/free 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 Description

Return Value

Description

output

Int, pointer address of the output aclDataBuffer.