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