GetStorageShape

Function Usage

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

Prototype

const Shape &GetStorageShape() const

Parameters

None

Returns

Read-only storage shape reference

Constraints

None

Examples

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