CopyToNpu
Function Usage
Creates a data copy task from the host to the device and places the task in the executor task queue.
Prototype
const aclTensor *CopyToNpu(const aclTensor *src, aclOpExecutor *executor)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
src |
Input |
Data to be copied from the host to the device. |
executor |
Input |
Operator executor object declared by the L2 first-phase API. |
Returns
aclTensor that points to the data copied to the device. If the task fails to be created, nullptr is returned.
Constraints
The input parameter pointer must not be null.
Example
1 2 3 4 5 6 | // Initialize a tensor on the host and copy it to the device (dst is a tensor on the device). void Func(aclOpExecutor *executor) { int64_t myArray[10]; auto src = executor->ConvertToTensor(myArray, 10, DT_INT64); auto dst = CopyToNpu(src, executor); } |
Parent topic: framework_op