Submodule containing implementations of linear algebra operations
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | transa | |||
| character(len=1), | intent(in) | :: | transb | |||
| integer, | intent(in) | :: | m | |||
| integer, | intent(in) | :: | n | |||
| integer, | intent(in) | :: | k | |||
| real(kind=real32), | intent(in) | :: | alpha | |||
| real(kind=real32), | intent(in) | :: | A(lda,*) | |||
| integer, | intent(in) | :: | lda | |||
| real(kind=real32), | intent(in) | :: | B(ldb,*) | |||
| integer, | intent(in) | :: | ldb | |||
| real(kind=real32), | intent(in) | :: | beta | |||
| real(kind=real32), | intent(inout) | :: | C(ldc,*) | |||
| integer, | intent(in) | :: | ldc |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=1), | intent(in) | :: | trans | |||
| integer, | intent(in) | :: | m | |||
| integer, | intent(in) | :: | n | |||
| real(kind=real32), | intent(in) | :: | alpha | |||
| real(kind=real32), | intent(in) | :: | A(lda,*) | |||
| integer, | intent(in) | :: | lda | |||
| real(kind=real32), | intent(in) | :: | x(*) | |||
| integer, | intent(in) | :: | incx | |||
| real(kind=real32), | intent(in) | :: | beta | |||
| real(kind=real32), | intent(inout) | :: | y(*) | |||
| integer, | intent(in) | :: | incy |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
Get partial derivative with respect to left operand of matmul
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
Get partial derivative with respect to right operand of matmul
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(inout) | :: | this | |||
| type(array_type), | intent(in) | :: | upstream_grad |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:,:) | :: | output |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:,:) | :: | output |
Compute gradient w.r.t. left operand for matmul in reverse mode.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:,:) | :: | output |
Sum-reduced gradient w.r.t. left operand for matmul. For the outer product case (rank-1 right operand), this computes: output = sum_s(upstream(:,s) (x) right(:,s)) = upstream * right^T using a single SGEMM call instead of computing the full (n_elem, S) array.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:) | :: | output |
Compute gradient w.r.t. right operand for matmul in reverse mode.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:,:) | :: | output |
Sum-reduced gradient w.r.t. right operand for matmul. For the outer product case (rank-1 left operand), this computes: output = sum_s(left(:,s) (x) upstream(:,s)) = left * upstream^T using a single SGEMM call.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:) | :: | output |
Dot product of two autodiff arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| class(array_type), | intent(in), | target | :: | b |
Matrix multiplication of two autodiff arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| class(array_type), | intent(in), | target | :: | b |
Matrix multiplication of a real array and an autodiff array Computes C = a * b where a is autodiff (vector per sample) and b is a real 2D matrix. Equivalent to C(:,s) = b^T * a(:,s) for each sample s.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | b |
Outer product of two autodiff arrays
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a | ||
| class(array_type), | intent(in), | target | :: | b |
Matrix multiplication of a real 2D matrix and an autodiff array Computes C = a * b where a is a real matrix and b is autodiff
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | dimension(:,:) | :: | a | ||
| class(array_type), | intent(in), | target | :: | b |
Transpose an autodiff array
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | a |