SetOriginalShape

Function Usage

Sets the OriginShape attribute of an aclTensor.

OriginShape indicates the original shape information of the aclTensor before it passes through the transdata node (if any), that is, the mathematical description of the tensor shape.

Prototype

void SetOriginalShape(const op::Shape &shape)

Parameters

Parameter

Input/Output

Description

shape

Input

The data type is op::Shape (that is, gert::Shape), which records a group of shape information, for example, a 3D shape [10, 20, 30].

Returns

None

Constraints

None

Example

1
2
3
4
5
6
7
8
// Set OriginShape of the input to [1, 2, 3, 4, 5].
void Func(aclTensor *input) {
    gert::Shape newShape;
    for (int64_t i = 1; i <= 5; i++) {
        newShape.AppendDim(i);
    }
    input->SetOriginalShape(newShape);
}