---
title: SetScalar
description: "设置shape为标量。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/maintenref/basicdataapi/atlasopapi_07_00156.html
sourcePath: /source/zh/canncommercial/900/maintenref/basicdataapi/atlasopapi_07_00156.html
indexId: 436c42ee5da4e061c1534650fb3237864d6278439c2088b62b883c6c4aaed9ce78
---
# SetScalar

#### 函数功能

设置shape为标量。


#### 函数原型

```
void SetScalar()
```


#### 参数说明

无。


#### 返回值说明

无。


#### 约束说明

无。


#### 调用示例

```
Shape shape0({3, 256, 256});
shape0.IsScalar(); // false
shape0.SetScalar();
shape0.IsScalar(); // true
```
