---
title: GetStorageFormat
description: "获取运行时Tensor中存储数据的实际排布格式。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00015.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00015.html
indexId: e7bf30f2f70b05d8b4eb34a4ce699dbf0e659a968feec2c6a343c5038a53840478
---
# GetStorageFormat

#### 函数功能

获取运行时Tensor中存储数据的实际排布格式。


#### 函数原型

```
ge::Format GetStorageFormat() const
```


#### 参数说明

无。


#### 返回值说明

运行时数据的实际排布格式。


#### 约束说明

无。


#### 调用示例

```
auto dtype_ = ge::DataType::DT_INT32;
StorageFormat fmt_(ge::Format::FORMAT_NC, ge::FORMAT_NCHW, {});
ExpandDimsType type_("1001");
gert::CompileTimeTensorDesc td;
td.SetDataType(dtype_);
auto dtype = td.GetDataType(); // ge::DataType::DT_INT32;
td.SetStorageFormat(fmt_.GetStorageFormat());
auto storage_fmt = td.GetStorageFormat(); // ge::FORMAT_NCHW
td.SetOriginFormat(fmt_.GetOriginFormat());
auto origin_fmt = td.GetOriginFormat(); // ge::Format::FORMAT_NC
td.SetExpandDimsType(type_);
auto type = td.GetExpandDimsType(); // type_("1001")
```
