---
title: SetOriginFormat
description: "设置Tensor的原始数据格式。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00755.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00755.html
indexId: 1f8451a3e49f2f676d07f305f3075678045e3358b273b2691c3a7fdff9d43ec878
---
# SetOriginFormat

#### 函数功能

设置Tensor的原始数据格式。


#### 函数原型

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


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| origin\_format | 输入 | 原始数据格式。 关于ge::Format类型的定义，请参见Format。 |


#### 返回值说明

无


#### 约束说明

无


#### 调用示例

```
StorageShape sh({1, 2, 3}, {1, 2, 3});
TensorV2 t = {sh, {ge::FORMAT_ND, ge::FORMAT_FRACTAL_NZ, {}}, kOnHost, ge::DT_FLOAT, nullptr};
t.SetOriginFormat(ge::FORMAT_NHWC);
t.SetStorageFormat(ge::FORMAT_NC1HWC0);
auto fmt = t.GetOriginFormat(); // ge::FORMAT_NHWC
```
