GetStorageShape

Description

Obtains the storage shape of a tensor. The shape object is read-only. The difference between Storgeshape and Originshape is as follows: Originshape is the shape of a tensor when the tensor is initially created, while Storgeshape is the shape of the underlying storage that stores the tensor data. To adapt to underlying hardware at runtime, the storage shape and original shape of a tensor may differ.

Prototype

const Shape &GetStorageShape() const

Parameters

None

Returns

Read-only storage shape reference

Restrictions

None

Example

StorageShape sh({1, 2, 3}, {2, 1, 3});
Tensor t = {sh, {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, kOnHost, ge::DT_FLOAT, nullptr};
auto shape = t.GetStorageShape(); // 2,1,3