dL/dx = D^T @ upstream [M, batch]
| 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 |
pure subroutine get_partial_lno_decode_spectral_val( & this, upstream_grad, output) !! dL/dx = D^T @ upstream [M, batch] implicit none class(array_type), intent(in) :: this real(real32), dimension(:,:), intent(in) :: upstream_grad real(real32), dimension(:,:), intent(out) :: output integer :: n_out, num_modes, mode_index, i, num_samples real(real32) :: t, mu_m real(real32), allocatable :: DT(:,:) ! [num_modes, n_out] n_out = this%indices(1) num_modes = this%indices(2) num_samples = size(upstream_grad, 2) allocate(DT(num_modes, n_out)) do mode_index = 1, num_modes mu_m = this%right_operand%val(mode_index, 1) do i = 1, n_out if(n_out .gt. 1)then t = real(i-1, real32) / real(n_out-1, real32) else t = 0.0_real32 end if DT(mode_index, i) = exp(-mu_m * t) end do end do output = matmul(DT, upstream_grad) deallocate(DT) end subroutine get_partial_lno_decode_spectral_val