Forward propagation for the Laplace Neural Operator layer
Computes: v = sigma( D @ R @ E @ u + W @ u + b )
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fixed_lno_layer_type), | intent(inout) | :: | this |
Layer instance to execute |
||
| class(array_type), | intent(in), | dimension(:,:) | :: | input |
Input batch tensor collection |
subroutine forward_fixed_lno(this, input) !! Forward propagation for the Laplace Neural Operator layer !! !! Computes: !! v = sigma( D @ R @ E @ u + W @ u + b ) implicit none ! Arguments class(fixed_lno_layer_type), intent(inout) :: this !! Layer instance to execute class(array_type), dimension(:,:), intent(in) :: input !! Input batch tensor collection ! Local variables type(array_type), pointer :: ptr, ptr_spec, ptr_local !! Combined output, spectral-path output and local-path output ! Spectral pathway: D @ R @ E @ u !--------------------------------------------------------------------------- ptr_spec => matmul(this%encoder_basis, input(1,1)) ! [M, batch] ptr_spec => matmul(this%params(1), ptr_spec) ! [M, batch] ptr_spec => matmul(this%decoder_basis, ptr_spec) ! [n_out, batch] ! Local bypass: W @ u !--------------------------------------------------------------------------- ptr_local => matmul(this%params(2), input(1,1)) ! [n_out, batch] ! Combine !--------------------------------------------------------------------------- ptr => ptr_spec + ptr_local ! Add bias !--------------------------------------------------------------------------- if(this%use_bias)then ptr => ptr + this%params(3) end if ! Apply activation !--------------------------------------------------------------------------- call this%output(1,1)%zero_grad() if(trim(this%activation%name) .eq. "none")then call this%output(1,1)%assign_and_deallocate_source(ptr) else call this%z(1)%zero_grad() call this%z(1)%assign_and_deallocate_source(ptr) this%z(1)%is_temporary = .false. ptr => this%activation%apply(this%z(1)) call this%output(1,1)%assign_and_deallocate_source(ptr) end if this%output(1,1)%is_temporary = .false. end subroutine forward_fixed_lno