---
title: HCgemvBatched
description: "| 硬件型号 | 支持情况 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/SiP/SIP_API_0066.html
sourcePath: /source/zh/canncommercial/900/API/SiP/SIP_API_0066.html
indexId: 5eb99e4c872c0952568d1b5c92f16de9b2b89094dfb7350ddb66499a856d54ca55
---
# HCgemvBatched

#### 产品支持情况

| 硬件型号 | 支持情况 |
| --- | --- |
| Atlas 200I/500 A2 推理产品 | 不支持 |
| Atlas 推理系列产品 | 不支持 |
| Atlas 训练系列产品 | 不支持 |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | 支持 |
| Atlas A3 推理系列产品 / Atlas A3 训练系列产品 | 不支持 |


#### 功能描述

接口功能

- asdBlasMakeHCgemvBatchedPlan：初始化该句柄对应的算子配置。
- asdBlasHCgemvBatched：用于计算批量复数矩阵与向量的乘积。

计算公式

- asdBlasHCgemvBatched的计算公式：
  其中op表示矩阵A做“共轭转置”或者“非转置”的操作。


- 示例：
  输入“inTensorA[i]”为：

```
[   [ 1+i, 1+2i ],
[ 1+3i, 1+4i ]  ]
```


  输入“x[i]”为：

```
[ 1+i, 1+i ]
```


  输入“trans”为： N，表示矩阵A非转置。

  输入“m”为：2，输入“n”为： 2，输入“alpha”为：1+0i，“beta”为：0+0i。

  输入“lda”为： 2。

  输入“batchCount”为：1。

  调用“asdBlasHCgemvBatched”算子后，输出“y[i]”为：

```
[0+4i, 0+8i]
```


#### 函数原型

- AspbStatus asdBlasMakeHCgemvBatchedPlan(asdBlasHandle handle, asdBlasOperation_t trans, const int64_t m)
- AspbStatus asdBlasHCgemvBatched(asdBlasHandle handle, asdBlasOperation_t trans, const int64_t m, const int64_t n,const std::complex<op::fp16_t> &alpha, aclTensor *A, const int64_t lda,aclTensor *x, const int64_t incx, const std::complex<op::fp16_t> &beta,aclTensor *y, const int64_t incy, const int64_t batchCount)


#### 参数说明

- asdBlasMakeHCgemvBatchedPlan| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | 算子的句柄。 |
| trans | Input | asdBlasOperation\_t | 指定矩阵A是否需要转置。 ASDBLAS\_OP\_N // 非转置 ASDBLAS\_OP\_C // 共轭转置 |
| m | Input | const int64\_t | 单批次矩阵A的行数。 |


- asdBlasHCgemvBatched| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | 算子的句柄。 |
| trans | Input | asdBlasOperation\_t | 指定矩阵A是否需要转置。 ASDBLAS\_OP\_N // 非转置 ASDBLAS\_OP\_C // 共轭转置 |
| m | Input | const int64\_t | 单批次矩阵A的行数。 |
| n | Input | const int64\_t | 单批次矩阵A的列数。 |
| alpha | Input | const std::complex<op::fp16\_t> & | 公式中的alpha，复数标量，用于乘以矩阵和向量乘法的结果，当前版本alpha的取值只能为1+0i。 |
| A | Input | aclTensor \* | 公式中的矩阵A，行主序，Device侧的Tensor，数据类型仅支持COMPLEX32，数据格式支持ND，shape为[batchCount ,m, n]。 |
| lda | Input | const int64\_t | A左右相邻元素间的内存地址偏移量（当前约束为m）。 |
| x | Input | aclTensor \* | 公式中的向量x，Device侧的Tensor，数据类型仅支持COMPLEX32，数据格式支持ND。 当“trans”取值为非转置：shape为[batchCount, n] 当“trans”取值为共轭转置：shape为[batchCount, m] |
| incx | Input | const int64\_t | 向量x的步长（当前约束为1）。 |
| beta | Input | const std::complex<op::fp16\_t> & | 公式中的beta，复数标量，用于乘以向量y ，当前版本beta的取值只能为0+0i。 |
| y | Input/Output | aclTensor \* | 公式中的向量y，Device侧的Tensor，数据类型仅支持COMPLEX64，数据格式支持ND。 当“trans”取值为非转置：shape为[batchCount, m] 当“trans”取值为共轭转置：shape为[batchCount, n] |
| incy | Input | const int64\_t | 向量y的步长（当前约束为1）。 |
| batchCount | Input | const int64\_t | 批次数量。取值范围为{12 \- 314496}。 |


#### 返回值说明

返回值相关说明参见返回值。


#### 约束说明

- asdBlasMakeCgemvBatchedPlan：无。
- asdBlasCgemvBatched

  - 支持的CANN版本为CANN8.0及以上。
  - 输入支持的数据类型为COMPLEX32。
  - 输出支持的数据类型为COMPLEX32。


#### 调用示例

算子的调用示例参见HcgemvBatched。
