Function: gemm_ex

C Prototype

aclError aclblasGemmEx(aclTransType transA,

aclTransType transB,

aclTransType transC,

int m,

int n,

int k,

const void *alpha,

const void *matrixA,

int lda,

aclDataType dataTypeA,

const void *matrixB,

int ldb,

aclDataType dataTypeB,

const void *beta,

void *matrixC,

int ldc,

aclDataType dataTypeC,

aclComputeType type,

aclrtStream stream)

Python Function

ret = acl.blas.gemm_ex(trans_a, trans_b, trans_c,

m, n, k,

alpha, matrix_a, lda, data_type_a,

matrix_b, ldb, data_type_b,

beta, matrix_c, ldc, data_type_c,

type, stream)

Function Usage

Computes matrix-matrix multiplication: C = αAB + βC. The data types of the input and output data are set using arguments. This API is asynchronous.

Input Description

trans_a: int, whether matrix A is transposed.

trans_b: int, whether matrix B is transposed.

trans_c: int, transpose flag of matrix C. Currently, only aclTrans_N is supported.

m: int, number of rows in matrix A and C.

n: int, number of columns in matrix B and C.

k: int, number of columns in matrix A and number of rows in matrix B.

alpha: int, data pointer address of Scalar α used for executing the multiplication operation.

matrix_a: int, data pointer address of matrix A.

lda: int, leading dimension of matrix A. For row-major transpose, lda is the number of columns of matrix A. This parameter is reserved and can only be set to –1.

data_type_a: int, data type of matrix A.

matrix_b: int, data pointer address of matrix B.

ldb: int, leading dimension of matrix B. For row-major transpose, ldb is the number of columns of matrix B. This parameter is reserved and can only be set to –1.

data_type_b: int, data type of matrix B.

beta: int, data pointer address of Scalar β used for executing the multiplication operation.

matrix_c: int, data pointer address of matrix C.

ldc: int, leading dimension of matrix C. This parameter is reserved and can only be set to –1.

data_type_c: int, data type of matrix C.

type: int, calculation precision.

stream: int, stream where the operator is executed.

Return Value

ret: int, error code.

Restrictions

Only the following data types of A, x and y are supported, and data type of α and β is the same as that of y.

Data Type of A Data Type of x Data Type of y

aclFloat16 aclFloat16 aclFloat16

aclFloat16 aclFloat16 float(float32)

int8_t int8_t float(float32)

int8_t int8_t int32_t

Reference

For details about the API call sequence and example, see API Call Sequence.