ViewCopy

Applicability

Product

Supported

Atlas 350 Accelerator Card

x

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

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);