Defines the layer type and its methods.
Overloads the default type constructor.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in) | :: | length |
Overloads the default type constructor.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in) | :: | dims(2) |
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 | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=rk), | public, | allocatable | :: | array(:) |
| private pure function array1d_constructor(length) | Overloads the default type constructor. |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=rk), | public, | allocatable | :: | array(:,:) |
| private pure function array2d_constructor(dims) | Overloads the default type constructor. |
| 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 |
| private function constructor(this_size, next_size) | 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. |
| procedure, public, pass(self) :: set_activation |
Overloads the default type constructor.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in) | :: | length |
Overloads the default type constructor.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=ik), | intent(in) | :: | dims(2) |
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 |
Performs a collective sum of bias tendencies.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array1d), | intent(inout), | allocatable | :: | db(:) |
Initialises biases structure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array1d), | intent(inout), | allocatable | :: | db(:) | ||
| integer(kind=ik), | intent(in) | :: | dims(:) |
Performs a collective sum of weights tendencies.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array2d), | intent(inout), | allocatable | :: | dw(:) |
Initialises weights structure.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(array2d), | intent(inout), | allocatable | :: | dw(:) | ||
| integer(kind=ik), | intent(in) | :: | dims(:) |
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 |