Performs the forward propagation and stores arguments to activation functions and activations themselves for use in backprop.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(network_type), | intent(inout) | :: | self | |||
| real(kind=rk), | intent(in) | :: | x(:) |
pure subroutine fwdprop(self, x)
!! Performs the forward propagation and stores arguments to activation
!! functions and activations themselves for use in backprop.
class(network_type), intent(in out) :: self
real(rk), intent(in) :: x(:)
integer(ik) :: n
associate(layers => self % layers)
layers(1) % a = x
do n = 2, size(layers)
layers(n) % z = matmul(transpose(layers(n-1) % w), layers(n-1) % a) + layers(n) % b
layers(n) % a = self % layers(n) % activation(layers(n) % z)
end do
end associate
end subroutine fwdprop