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

#### 产品支持情况

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


#### 功能描述

接口功能

- asdBlasMakeSsyrPlan：初始化该句柄对应的Ssyr算子配置。

- asdBlasSsyr：用于计算单精度向量的外积并将结果加到一个矩阵上。

计算公式

- asdBlasSsyr的计算公式：
- 示例：
  输入“x”为：

```
[   [ 1 ],
[ 2 ] ]
```


  输入“A”为：

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


  输入“uplo”为：U

  输入“n”为：2，输入“lda”为：2，输入“incx”为：1。

  输入“alpha”为：2.0。

  其中，为：

```
[ 1, 2 ]
```


  为：

```
[ 2, 4 ]
```


  为：

```
[ [ 2 ], [ 4 ] ] × [ 1, 2 ] =  [ [ 2, 4 ], [ 4, 8 ] ]
```


  调用“Ssyr”算子后，更新上三角数据，输出“A”为：

```
[   [ 3, 6 ],
[ 3, 12 ]  ].
```


#### 函数原型

- AspbStatus asdBlasMakeSsyrPlan(asdBlasHandle handle)
- AspbStatus asdBlasSsyr(asdBlasHandle handle, asdBlasFillMode_t uplo, const int64_t n, const float *alpha, aclTensor *x, const int64_t incx, aclTensor *A, const int64_t lda)


#### 参数说明

- asdBlasMakeSsyrPlan| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | ssyr算子的句柄。 |


- asdBlasSsyr| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | ssyr算子的句柄。 |
| uplo | Input | asdBlasFillMode\_t | 指定矩阵A的存储方式。 ASDBLAS\_FILL\_MODE\_LOWER // 下三角 ASDBLAS\_FILL\_MODE\_UPPER // 上三角 |
| n | Input | const int64\_t | 向量x中的元素个数，矩阵A的行列数。 |
| alpha | Input | const float \* | 公式中的alpha，标量，向量乘积缩放因子。 |
| x | Input | aclTensor \* | 公式中的x，Device侧的Tensor，数据类型支持FLOAT32，数据格式支持ND，shape为[n]。 |
| incx | Input | const int64\_t | x相邻元素间的内存地址偏移量（当前约束为1）。 |
| A | Input/Output | aclTensor \* | 公式中的A，Device侧的Tensor，数据类型支持FLOAT32，数据格式支持ND，shape为[n, n]。 |
| lda | Input | const int64\_t | 矩阵A的每列元素的存储步长（当前约束为n）。 |


#### 返回值说明

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


#### 约束说明

- asdBlasMakeSsyrPlan：无。

- asdBlasSsyr

  - 输入的元素个数n当前覆盖支持[1, 16384]。
  - 算子输入shape为[n]、[n, n]，输出shape为[n, n]。
  - 算子实际计算时，不支持ND高维度运算（不支持维度≥3的运算）。


#### 调用示例

算子的调用示例参见Ssyr。
