GetStorageShape

Function Usage

Obtains the storage shape of a tensor at runtime. 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

1
const Shape &GetStorageShape() const

Parameters

None

Returns

Reference to the read-only shape at runtime.

Constraints

None

Examples

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