GetStorageShape

Function Usage

Obtains the storage shape of a tensor. The shape object is read-only. The difference between the storage shape and original shape is as follows: The original shape is the shape of a tensor when the tensor is initially created, while the storage shape 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

Reference to the read-only shape at runtime.

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