CopyNpuToNpu

Function Usage

Creates a data copy task from a device to another device and places the task in the executor task queue.

Prototype

aclnnStatus CopyNpuToNpu(const aclTensor *src, const aclTensor *dst, aclOpExecutor *executor)

Parameters

Parameter

Input/Output

Description

src

Input

Source tensor to be copied.

dst

Input

Destination tensor.

executor

Input

Operator executor object declared by the L2 first-phase API.

Returns

If a data copy task is successfully created, ACLNN_SUCCESS (status code 0) is returned. Otherwise, an aclnn error code is returned.

Constraints

The input parameter pointer must not be null.

Example

1
2
3
4
5
6
// Create a task for copying data from src to dst. If the task fails to be created, a return statement is executed.
void Func(const aclTensor *src, const aclTensor *dst, aclOpExecutor *executor) {
    if (CopyNpuToNpu(src, dst, executor) != ACLNN_SUCCESS) {
        return;
    }
}