Function: set_tensor_const

C Prototype

aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length)

Python Function

ret = acl.set_tensor_const(desc, dataBuffer, length)

Function Usage

Sets a constant input for an operator and specifies the buffer address for storing the input tensor data and address length.

Input Description

desc: int, pointer address of aclTensorDesc.

Call acl.create_tensor_desc to create data of the aclTensorDesc type in advance.

dataBuffer: int, address of the memory for storing the input tensor of the constant.

The memory for storing the input tensor data of the operator must be determined based on the application running mode. For details about the buffer allocation API, see Memory Management.

  • If the app runs on the host, allocate host buffer.
  • If the app runs on the device, allocate device buffer.

length: int, buffer address size, in bytes.

Return Value

ret: int, error code.

Restrictions

None