---
title: SetViewFormat
description: "设置aclTensor的ViewFormat。ViewFormat为aclTensor的逻辑Format。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/aolapi/atlasascendc_api_07_1079.html
sourcePath: /source/zh/canncommercial/900/API/aolapi/atlasascendc_api_07_1079.html
indexId: e3033a9ed5597ce4f70f766c28b1a84557b713e39b5f503f538f7aab643df67f70
---
# SetViewFormat

#### 功能说明

设置aclTensor的ViewFormat。ViewFormat为aclTensor的逻辑Format。


#### 函数原型

```
void SetViewFormat(op::Format format)
```


#### 参数说明

| 参数 | 输入/输出 | 说明 |
| --- | --- | --- |
| format | 输入 | 数据类型为op::Format（即ge::Format），本身是一个枚举，包含多种不同的Format，例如NCHW、ND等。 说明： ge::Format介绍参见《基础数据结构和接口(https://www.hiascend.com/document/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi\_07\_00001.html)》中“ge::Format(https://www.hiascend.comdocument/detail/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi\_07\_00515.html)”。 |


#### 返回值说明

无


#### 约束说明

无


#### 调用示例

```
// 将input的ViewFormat置为ND格式
void Func(const aclTensor *input) {
    input->SetViewFormat(ge::FORMAT_ND);
}
```
