Allocates and initializes the layers with given dimensions dims.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(network_type), | intent(inout) | :: | self | |||
| integer(kind=ik), | intent(in) | :: | dims(:) |
subroutine init(self, dims)
!! Allocates and initializes the layers with given dimensions dims.
class(network_type), intent(in out) :: self
integer(ik), intent(in) :: dims(:)
integer(ik) :: n
self % dims = dims
if (.not. allocated(self % layers)) allocate(self % layers(size(dims)))
do n = 1, size(dims) - 1
self % layers(n) = layer_type(dims(n), dims(n+1))
end do
self % layers(n) = layer_type(dims(n), 1)
self % layers(1) % b = 0
self % layers(size(dims)) % w = 0
end subroutine init