matmul

Computes the matrix multiplication between two rank-2 tensors.

matmul
(
,,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

lhs
Type: Operation

The tensor on the left-hand side of the operation.

rhs
Type: Operation

The tensor on the right-hand side of the operation.

Return Value

Type: Operation

The resulting operation.

Examples

1 import dopt.core : evaluate;
2 
3 auto a = float32([2, 1], [
4     1.0f,
5     2.0f
6 ]);
7 
8 auto b = float32([1, 2], [
9     3.0f, 4.0f
10 ]);
11 
12 auto c = matmul(a, b);
13 
14 assert(c.evaluate().as!float == [
15     3.0f, 4.0f,
16     6.0f, 8.0f
17 ]);

Meta