Function: set_tensor_const

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product / Atlas A3 inference product

Atlas A2 training product / Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Function Usage

Sets a constant input for an operator and specifies the memory 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)
    

Parameters

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 constant input tensor data.

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

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

length

Int, length of the memory address, in bytes.

Returns

Return Value

Description

ret

Int, error code.