---
title: SetOriginFormat
description: "向CompileTimeTensorDesc中设置Tensor的原始数据排布格式。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00019.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00019.html
indexId: 8237f83a7a2d75a36bc74c10631b9160a85882f226f0cd8360fe32a04661b80c78
---
# SetOriginFormat

#### 函数功能

向CompileTimeTensorDesc中设置Tensor的原始数据排布格式。


#### 函数原型

```
void SetOriginFormat(const ge::Format format)
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| format | 输入 | 需要设置的原始数据排布格式信息。 关于ge::Format的定义，请参见Format。 |


#### 返回值说明

无。


#### 约束说明

无。


#### 调用示例

```
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")
```
