ToShape

Function Usage

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

Prototype

  • Construct op::Shape with the given dims array.
    void ToShape(const int64_t *dims, uint64_t dimNum, op::Shape &shape)
  • Construct op::Shape with the given op::ShapeVector array.

    For details about op::ShapeVector, see Table 3.

    void ToShape(const op::ShapeVector &shapeVector, op::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

Examples

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