Function: set_tensor_const

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

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

Prototype

  • C Prototype
    1
    aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length)
    
  • Python Function
    1
    ret = acl.set_tensor_const(desc, dataBuffer, length)
    

Parameter Description

Parameter

Description

desc

Int, pointer address of the aclTensorDesc type.

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 memory.

length

Int, length of the memory address, in bytes.

Return Value Description

Return Value

Description

ret

Int, error code.