Function: set_tensor_const
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Sets a constant input for an operator and specifies the buffer address for storing the input tensor data and address length.
Prototype
-
C Prototype
aclError aclSetTensorConst(aclTensorDesc *desc, void *dataBuffer, size_t length) -
Python Function
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 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 memory allocation APIs, see Memory Management. If the app runs on the host, allocate the memory of the host. If the app runs on the device, allocate device memory. |
| length | Int, length of the memory address, in bytes. |
Return Values
| Return Value | Description |
|---|---|
| ret | Int, error code.0: successOther values: failure |