| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=rk), | public, | allocatable | :: | a(:) | activations |
||
| procedure(activation_function), | public, | pointer, nopass | :: | activation | => | null() | |
| procedure(activation_function), | public, | pointer, nopass | :: | activation_prime | => | null() | |
| character(len=:), | public, | allocatable | :: | activation_str | activation character string |
||
| real(kind=rk), | public, | allocatable | :: | b(:) | biases |
||
| real(kind=rk), | public, | allocatable | :: | w(:,:) | weights |
||
| real(kind=rk), | public, | allocatable | :: | z(:) | arg. to activation function |
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 |
Sets the activation function. Input string must match one of provided activation functions, otherwise it defaults to sigmoid. If activation not present, defaults to sigmoid.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(layer_type), | intent(inout) | :: | self | |||
| character(len=*), | intent(in) | :: | activation |
type :: layer_type
real(rk), allocatable :: a(:) !! activations
real(rk), allocatable :: b(:) !! biases
real(rk), allocatable :: w(:,:) !! weights
real(rk), allocatable :: z(:) !! arg. to activation function
procedure(activation_function), pointer, nopass :: activation => null()
procedure(activation_function), pointer, nopass :: activation_prime => null()
character(len=:), allocatable :: activation_str !! activation character string
contains
procedure, public, pass(self) :: set_activation
end type layer_type