---
title: SetCType
description: "设置C矩阵的位置，数据格式，数据类型等信息，这些信息需要和kernel侧的设置保持一致。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/ascendcopapi/atlasascendc_api_07_0676.html
sourcePath: /source/zh/canncommercial/900/API/ascendcopapi/atlasascendc_api_07_0676.html
indexId: 6c838ad02d7a936371a77bd9a7481e259cb4e7dbb0a2b7f886c376969566dbc976
---
# SetCType

#### 功能说明

设置C矩阵的位置，数据格式，数据类型等信息，这些信息需要和kernel侧的设置保持一致。


#### 函数原型

```
int32_t SetCType(TPosition pos, CubeFormat type, DataType dataType)
```


#### 参数说明


**表1 参数说明**

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| pos | 输入 | C矩阵所在的buffer位置，可设置为：TPosition::GM, TPosition::VECIN。 |
| type | 输入 | C矩阵的数据格式，可设置为：CubeFormat::ND，CubeFormat::NZ, CubeFormat::ND\_ALIGN。 |
| dataType | 输入 | C矩阵的数据类型，可设置为：DataType::DT\_FLOAT/DataType::DT\_FLOAT16/DataType::DT\_BFLOAT16 /DataType::DT\_INT8/DataType::DT\_INT32/DataType::DT\_FLOAT8\_E4M3FN/DataType::DT\_HIFLOAT8。 |


#### 返回值说明

-1表示设置失败；0表示设置成功。


#### 约束说明

无


#### 调用示例

```
auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
matmul_tiling::MatmulApiTiling tiling(ascendcPlatform); 
 
// 设置C矩阵，buffer位置为GM，数据格式为ND，数据类型为float，默认不转置
tiling.SetCType(matmul_tiling::TPosition::GM, matmul_tiling::CubeFormat::ND, matmul_tiling::DataType::DT_FLOAT);
```
