ToDevice

Function Usage

Transfers the tensor data to the device.
  • If the original memory is transferred by the user through the constructor, the memory needs to be managed and destroyed by the user.
  • If the memory is allocated by using TensorMalloc, data is transferred to the device, and the original memory is automatically destroyed.

Prototype

APP_ERROR ToDevice(int32_t deviceId)

Parameter Description

Parameter

Input/Output

Description

deviceId

Input

Transfers a tensor to the device specified by deviceId.

Return Parameter Description

Data Structure

Description

APP_ERROR

Error code returned during program execution. For details, see the MxBase/ErrorCode/ErrorCode.h file.