Layer class constructor. this_size is the number of neurons in the layer. next_size is the number of neurons in the next layer, used to allocate the weights.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in) | :: | this_size | |||
| integer(kind=ik), | intent(in) | :: | next_size |
type(layer_type) function constructor(this_size, next_size) result(layer)
!! Layer class constructor. this_size is the number of neurons in the layer.
!! next_size is the number of neurons in the next layer, used to allocate
!! the weights.
integer(ik), intent(in) :: this_size, next_size
allocate(layer % a(this_size))
allocate(layer % z(this_size))
layer % a = 0
layer % z = 0
layer % w = randn(this_size, next_size) / this_size
layer % b = randn(this_size)
end function constructor