ToShape

Function Usage

Converts data of the specified memory dimensions into an op::Shape (gert::Shape) object.

Prototype

  • Construct op::Shape with the given dims array.

    void ToShape(const int64_t *dims, uint64_t dimNum, Shape &shape)

  • Construct op::Shape with the given op::ShapeVector array.

    void ToShape(const FVector<int64_t, 25> shapeVector, Shape &shape)

Parameters

Parameter

Input/Output

Description

dims

Input

Pointer to the source data, pointing to the memory for the size of each dimension.

dimNum

Input

Number of dimensions in the source data to which dims points.

shapeVector

Input

Source data. The list stores the size of each dimension.

shape

Output

Shape object constructed based on the source data.

Returns

None

Constraints

None

Example

1
2
3
4
5
6
// Generate a shape object whose shape is [1, 2, 3, 4, 5].
void Func() {
    int64_t myArray[5] = {1, 2, 3, 4, 5};
    Shape shape;
    ToShape(myArray, 5, shape);
}