chainer.functions.matmul

chainer.functions.matmul(a, b, transa=False, transb=False)[source]

Computes the matrix multiplication of two arrays.

Parameters:
  • a (Variable) – The left operand of the matrix multiplication. A 1-D array of shape (N,) is considered as an \(N \times 1\) matrix. A 2-D array of shape (M, N) is considered as an \(M \times N\) matrix.
  • b (Variable) – The right operand of the matrix multiplication. Its array is treated as a matrix in the same way as a‘s array.
  • transa (bool) – If True, transpose a.
  • transb (bool) – If True, transpose b.
Returns:

The result of the matrix multiplication as a 2-D

array.

Return type:

Variable