Welcome to our Support Center

Gemm

Description

General Matrix multiplication: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3

  • A’ = transpose(A) if transA else A

  • B’ = transpose(B) if transB else B

 

 

Compute Y = alpha * A’ * B’ + beta * C, where input tensor A has shape (M, K) or (K, M), input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), and output tensor Y has shape (M, N). A will be transposed before doing the computation if attribute transA is non-zero, same for B and transB. This operator supports unidirectional broadcasting (tensor C should be unidirectional broadcastable to tensor A * B); for more details please check Broadcasting in ONNX. This operator has optional inputs/outputs. See ONNX IR for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument’s name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted.

 

Input parameters

 

specified_outputs_namearray, this parameter lets you manually assign custom names to the output tensors of a node.

 Graphs in : cluster, ONNX model architecture.

 A (heterogeneous) – T : object, input tensor A. The shape of A should be (M, K) if transA is 0, or (K, M) if transA is non-zero.
 B (heterogeneous) – T : object, input tensor B. The shape of B should be (K, N) if transB is 0, or (N, K) if transB is non-zero.
 C (optional, heterogeneous) – T : object, optional input tensor C. If not specified, the computation is done as if C is a scalar 0. The shape of C should be unidirectional broadcastable to (M, N).

 Parameters : cluster,

alpha : float, scalar multiplier for the product of input tensors A * B.
Default value “1”.
beta : float, scalar multiplier for input tensor C.
Default value “1”.
 transA : boolean, whether A should be transposed.
Default value “False”.
transB : boolean, whether B should be transposed.
Default value “False”.
 training? : boolean, whether the layer is in training mode (can store data for backward).
Default value “True”.
 lda coeff : float, defines the coefficient by which the loss derivative will be multiplied before being sent to the previous layer (since during the backward run we go backwards).
Default value “1”.

 name (optional) : string, name of the node.

Output parameters

 

 Y (heterogeneous) – T : object, output tensor of shape (M, N).

Type Constraints

T in (tensor(bfloat16)tensor(double)tensor(float)tensor(float16)tensor(int32)tensor(int64)tensor(uint32)
tensor(uint64)) : Constrain input and output types to float/int tensors.

Example

All these exemples are snippets PNG, you can drop these Snippet onto the block diagram and get the depicted code added to your VI (Do not forget to install Deep Learning library to run it).
Table of Contents