Cgemm
计算公式
asdBlasCgemm
- 计算公式:
其中,
- 示例:
[ [ 1+i, 1+2i ], [ 1+3i, 1+4i ] ]
输入“inTensorB”为:
[ [ 2+i, 2+2i ], [ 2+3i, 2+4i ] ]
输入“inTensorC”为:
[ [ 3+i, 3+2i ], [ 3+3i, 3+4i ] ]
输入“transa”为: N,输入“transb”为:T,
输入“m”为:2,输入“n”为: 2,输入“k”为:2,输入“alpha”为:1+i,“beta”为:2+2i,
输入“lda”为: 2,输入“ldb”为:2,输入“ldc”为:2,
调用“Cgemm”算子后,
输出“outTensor”为:
[ [ -15+19i, -27+19i ], [ -37+21i, -57+13i ] ]
接口原型
- AspbStatus asdBlasMakeCgemmPlan(asdBlasHandle handle, asdBlasOperation_t transa, asdBlasOperation_t transb, int64_t m,int64_t n, int64_t k, int64_t lda, int64_t ldb, int64_t ldc)
- AspbStatus asdBlasCgemm(asdBlasHandle handle, asdBlasOperation_t transa, asdBlasOperation_t transb, const int64_t m,const int64_t n, const int64_t k, const std::complex<float> *alpha, aclTensor *A,const int64_t lda, aclTensor *B, const int64_t ldb, const std::complex<float> *beta,aclTensor *C, const int64_t ldc)
参数列表
- asdBlasMakeCgemmPlan
参数名称
Input/Output
类型
描述
handle
Input
asdBlasHandle
cgemm算子的句柄。
transa
Input
asdBlasOperation_t
指定矩阵A是否需要转置。
ASDBLAS_OP_N // 不转置 ASDBLAS_OP_T // 转置 ASDBLAS_OP_C // 共轭转置
transb
Input
asdBlasOperation_t
指定矩阵B是否需要转置。
ASDBLAS_OP_N // 不转置 ASDBLAS_OP_T // 转置 ASDBLAS_OP_C // 共轭转置
m
Input
const int64_t
矩阵A和C的行数。
n
Input
const int64_t
矩阵B和C的列数。
k
Input
const int64_t
矩阵A和B的公共维度。
lda
Input
const int64_t
A左右相邻元素间的内存地址偏移量(当前约束为m)。
ldb
Input
const int64_t
B左右相邻元素间的内存地址偏移量(当前约束为k)。
ldc
Input
const int64_t
C左右相邻元素间的内存地址偏移量(当前约束为m)。
- asdBlasCgemm
参数名称
Input/Output
类型
描述
handle
Input
asdBlasHandle
cgemm算子的句柄。
transa
Input
asdBlasOperation_t
指定矩阵A是否需要转置。
ASDBLAS_OP_N // 不转置 ASDBLAS_OP_T // 转置 ASDBLAS_OP_C // 共轭转置
transb
Input
asdBlasOperation_t
指定矩阵B是否需要转置。
ASDBLAS_OP_N // 不转置 ASDBLAS_OP_T // 转置 ASDBLAS_OP_C // 共轭转置
m
Input
const int64_t
矩阵C的行数。
n
Input
const int64_t
矩阵C的列数。
k
Input
const int64_t
矩阵A和B的公共维度。
alpha
Input
const std::complex<float> *
公式中的alpha,复数标量,用于乘以矩阵乘法的结果。
A
Input
aclTensor *
公式中的A,列主序,Device侧的Tensor,数据类型仅支持COMPLEX64,数据格式支持ND,shape为[m,k]。
lda
Input
const int64_t
A左右相邻元素间的内存地址偏移量(当前约束为m)。
B
Input
aclTensor *
公式中的B,Device侧的Tensor,数据类型仅支持COMPLEX64,数据格式支持ND,shape为[k,n]。
ldb
Input
const int64_t
B左右相邻元素间的内存地址偏移量(当前约束为k)。
beta
Input
const std::complex<float> *
公式中的beta,复数标量,用于乘以矩阵C。
C
Input/Output
aclTensor *
公式中的C,Device侧的Tensor,数据类型仅支持COMPLEX64,数据格式支持ND,shape为[m,n]。
ldc
Input
const int64_t
C左右相邻元素间的内存地址偏移量(当前约束为m)。
规格约束
- asdBlasMakeCgemmPlan:无。
- asdBlasCgemm
- 输入的元素个数m,n,k当前覆盖支持[1,8192];
- 算子输入数据为列主序,输入shape为[m,k]、[k,n]、[m,n],输出shape为[m,n];
- 算子实际计算时,不支持ND高维度运算(不支持维度≥3的运算)。