Forward propagation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(full_layer_type), | intent(inout) | :: | this |
Instance of the fully connected layer |
||
| class(array_type), | intent(in), | dimension(:,:) | :: | input |
Input values |
subroutine forward_full(this, input) !! Forward propagation implicit none ! Arguments class(full_layer_type), intent(inout) :: this !! Instance of the fully connected layer class(array_type), dimension(:,:), intent(in) :: input !! Input values type(array_type), pointer :: ptr => null() ! Generate outputs from weights, biases, and inputs !--------------------------------------------------------------------------- if(this%use_bias)then ptr => matmul(this%params(1), input(1,1) ) + this%params(2) else ptr => matmul(this%params(1), input(1,1) ) end if ! Apply activation function to 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_full