CheckCopyValid

Function Usage

Checks whether the memory lengths of the two TensorBuffer objects are the same and meets the conditions for mutual copy.

Prototype

static APP_ERROR CheckCopyValid(const TensorBuffer &buffer1, const TensorBuffer &buffer2);

Parameter Description

Parameter

Input/Output

Description

buffer1

Input

TensorBuffer object. Ensure that the size of the allocated memory is the same as the value of size.

buffer2

Input

TensorBuffer object. Ensure that the size of the allocated memory is the same as the value of size.

Return Parameter Description

Data Structure

Description

TensorBufferCopyType

Data type of the two tensor buffers.

  • HOST_AND_HOST: The two tensor buffers are on the host.
  • HOST_AND_DEVICE: One tensor buffer is on the host, and the other is on the device.
  • DEVICE_AND_SAME_DEVICE: The two tensor buffers are on the device and have the same device ID.
  • DEVICE_AND_DIFF_DEVICE: The two tensor buffers are on the device but have different device IDs.