ViewCopy

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Function Usage

Moves a contiguous tensor to a contiguous or non-contiguous tensor. This function is a public L0 API.

An output tensor of L2 API may be non-contiguous. Therefore, a contiguous tensor needs to be moved to a non-contiguous tensor by using this API.

An output tensor can be contiguous or non-contiguous, which will be processed in the API for better compatibility. However, it requires a contiguous input tensor.

Prototype

const aclTensor *ViewCopy(const aclTensor *x, const aclTensor *y, aclOpExecutor *executor)

Parameters

Parameter

Input/Output

Description

x

Input

Input tensor. The data type and format are not restricted. The input must be contiguous memory data.

y

Output

Output tensor. The data type and format are not restricted, except that the data type, ViewShape, and data format must be the same as those of x.

executor

Input

Operator executor, containing the operator computation process.

Returns

Success: An output tensor is returned. Failure: nullptr is returned.

Constraints

The input tensor must be contiguous.

Examples

1
2
3
4
// Standard format for creating an OpExecutor
auto uniqueExecutor = CREATE_EXECUTOR();
// If out is a non-contiguous tensor, the computed contiguous tensor must be converted into a non-contiguous tensor.
auto viewCopyResult = l0op::ViewCopy(absResult, out, executor);