Function: update_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

Updates the buffer and size of the data in the aclDataBuffer.

After the aclDataBuffer is updated, free the aclDataBuffer memory when it is no longer needed to avoid memory leak.

Prototype

  • C Prototype
    1
    aclError aclUpdateDataBuffer(aclDataBuffer *dataBuffer, void *data, size_t size)
    
  • Python Function
    1
    ret = acl.update_data_buffer(data_buffer, data, size)
    

Parameters

Parameter

Description

data_buffer

Int, pointer address of the aclDataBuffer type.

Call acl.create_data_buffer to create data of the aclDataBuffer type in advance.

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.

data

Int, pointer address for storing the data memory address.

size

Int, memory size, in bytes. If an empty tensor is needed, allocate at least 1 byte buffer.

Return Values

Return Value

Description

ret

Int, error code.