Module containing the implementation of the He initialiser
This module implements He (Kaiming/MSRA) initialisation, designed for layers with ReLU activation to prevent vanishing/exploding gradients.
Mathematical operation:
Uniform variant:
Normal variant:
where is the number of input units (fan-in).
Rationale: Maintains variance through ReLU layers
Best for: ReLU, Leaky ReLU, PReLU activations Reference: He et al. (2015), ICCV, arXiv:1502.01852
Interface for the He normal initialiser
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Scaling factor (default: 1.0) |
|
| character(len=*), | intent(in), | optional | :: | mode |
Mode for calculating the scaling factor (default: "fan_in") |
He normal initialiser object
Interface for the He uniform initialiser
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Scaling factor (default: 1.0) |
|
| character(len=*), | intent(in), | optional | :: | mode |
Mode for calculating the scaling factor (default: "fan_in") |
He uniform initialiser object
Type for the He initialiser (normal)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real32), | public | :: | mean | = | 1._real32 |
Scale, mean, and standard deviation of the initialiser |
|
| character(len=20), | public | :: | name |
Name of the initialiser |
|||
| real(kind=real32), | public | :: | scale | = | 1._real32 |
Scale, mean, and standard deviation of the initialiser |
|
| real(kind=real32), | public | :: | std | = | 0.01_real32 |
Scale, mean, and standard deviation of the initialiser |
|
| integer, | private | :: | mode | = | 1 |
| private module function initialiser_normal_setup (scale, mode) | Interface for the He normal initialiser |
| procedure, public, pass(this) :: initialise => he_normal_initialise | Initialise the weights and biases using the He normal distribution |
Type for the He initialiser (uniform)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real32), | public | :: | mean | = | 1._real32 |
Scale, mean, and standard deviation of the initialiser |
|
| character(len=20), | public | :: | name |
Name of the initialiser |
|||
| real(kind=real32), | public | :: | scale | = | 1._real32 |
Scale, mean, and standard deviation of the initialiser |
|
| real(kind=real32), | public | :: | std | = | 0.01_real32 |
Scale, mean, and standard deviation of the initialiser |
|
| integer, | private | :: | mode | = | 1 |
| private module function initialiser_uniform_setup (scale, mode) | Interface for the He uniform initialiser |
| procedure, public, pass(this) :: initialise => he_uniform_initialise | Initialise the weights and biases using the He uniform distribution |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Scaling factor (default: 1.0) |
|
| character(len=*), | intent(in), | optional | :: | mode |
Mode for calculating the scaling factor (default: "fan_in") |
He normal initialiser object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in), | optional | :: | scale |
Scaling factor (default: 1.0) |
|
| character(len=*), | intent(in), | optional | :: | mode |
Mode for calculating the scaling factor (default: "fan_in") |
He uniform initialiser object
Initialise the weights and biases using the He normal distribution
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(he_normal_init_type), | intent(inout) | :: | this |
Instance of the He initialiser |
||
| real(kind=real32), | intent(out), | dimension(..) | :: | input |
Weights and biases to initialise |
|
| integer, | intent(in), | optional | :: | fan_in |
Number of input and output parameters |
|
| integer, | intent(in), | optional | :: | fan_out |
Number of input and output parameters |
|
| integer, | intent(in), | optional, | dimension(:) | :: | spacing |
Spacing of the input and output units (not used) |
Initialise the weights and biases using the He uniform distribution
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(he_uniform_init_type), | intent(inout) | :: | this |
Instance of the Glorot initialiser |
||
| real(kind=real32), | intent(out), | dimension(..) | :: | input |
Weights and biases to initialise |
|
| integer, | intent(in), | optional | :: | fan_in |
Number of input and output units |
|
| integer, | intent(in), | optional | :: | fan_out |
Number of input and output units |
|
| integer, | intent(in), | optional, | dimension(:) | :: | spacing |
Spacing of the input and output units (not used) |