11module mod_layer
22
3- ! Defines the layer type and its methods.
3+ ! ! Defines the layer type and its methods.
44
55 use mod_activation
66 use mod_kinds, only: ik, rk
@@ -12,13 +12,13 @@ module mod_layer
1212 public :: array1d, array2d, db_init, db_co_sum, dw_init, dw_co_sum, layer_type
1313
1414 type :: layer_type
15- real (rk), allocatable :: a(:) ! activations
16- real (rk), allocatable :: b(:) ! biases
17- real (rk), allocatable :: w(:,:) ! weights
18- real (rk), allocatable :: z(:) ! arg. to activation function
15+ real (rk), allocatable :: a(:) ! ! activations
16+ real (rk), allocatable :: b(:) ! ! biases
17+ real (rk), allocatable :: w(:,:) ! ! weights
18+ real (rk), allocatable :: z(:) ! ! arg. to activation function
1919 procedure (activation_function), pointer , nopass :: activation = > null ()
2020 procedure (activation_function), pointer , nopass :: activation_prime = > null ()
21- character (len= :), allocatable :: activation_str ! activation character string
21+ character (len= :), allocatable :: activation_str ! ! activation character string
2222 contains
2323 procedure , public , pass(self) :: set_activation
2424 end type layer_type
@@ -46,9 +46,9 @@ module mod_layer
4646contains
4747
4848 type (layer_type) function constructor(this_size, next_size) result(layer)
49- ! Layer class constructor. this_size is the number of neurons in the layer.
50- ! next_size is the number of neurons in the next layer, used to allocate
51- ! the weights.
49+ ! ! Layer class constructor. this_size is the number of neurons in the layer.
50+ ! ! next_size is the number of neurons in the next layer, used to allocate
51+ ! ! the weights.
5252 integer (ik), intent (in ) :: this_size, next_size
5353 allocate (layer % a(this_size))
5454 allocate (layer % z(this_size))
@@ -59,21 +59,21 @@ type(layer_type) function constructor(this_size, next_size) result(layer)
5959 end function constructor
6060
6161 pure type (array1d) function array1d_constructor(length) result(a)
62- ! Overloads the default type constructor.
62+ ! ! Overloads the default type constructor.
6363 integer (ik), intent (in ) :: length
6464 allocate (a % array(length))
6565 a % array = 0
6666 end function array1d_constructor
6767
6868 pure type (array2d) function array2d_constructor(dims) result(a)
69- ! Overloads the default type constructor.
69+ ! ! Overloads the default type constructor.
7070 integer (ik), intent (in ) :: dims(2 )
7171 allocate (a % array(dims(1 ), dims(2 )))
7272 a % array = 0
7373 end function array2d_constructor
7474
7575 pure subroutine db_init (db , dims )
76- ! Initialises biases structure.
76+ ! ! Initialises biases structure.
7777 type (array1d), allocatable , intent (in out ) :: db(:)
7878 integer (ik), intent (in ) :: dims(:)
7979 integer (ik) :: n, nm
@@ -86,7 +86,7 @@ pure subroutine db_init(db, dims)
8686 end subroutine db_init
8787
8888 pure subroutine dw_init (dw , dims )
89- ! Initialises weights structure.
89+ ! ! Initialises weights structure.
9090 type (array2d), allocatable , intent (in out ) :: dw(:)
9191 integer (ik), intent (in ) :: dims(:)
9292 integer (ik) :: n, nm
@@ -99,7 +99,7 @@ pure subroutine dw_init(dw, dims)
9999 end subroutine dw_init
100100
101101 subroutine db_co_sum (db )
102- ! Performs a collective sum of bias tendencies.
102+ ! ! Performs a collective sum of bias tendencies.
103103 type (array1d), allocatable , intent (in out ) :: db(:)
104104 integer (ik) :: n
105105 do n = 2 , size (db)
@@ -110,7 +110,7 @@ subroutine db_co_sum(db)
110110 end subroutine db_co_sum
111111
112112 subroutine dw_co_sum (dw )
113- ! Performs a collective sum of weights tendencies.
113+ ! ! Performs a collective sum of weights tendencies.
114114 type (array2d), allocatable , intent (in out ) :: dw(:)
115115 integer (ik) :: n
116116 do n = 1 , size (dw) - 1
@@ -121,9 +121,9 @@ subroutine dw_co_sum(dw)
121121 end subroutine dw_co_sum
122122
123123 pure elemental subroutine set_activation(self, activation)
124- ! Sets the activation function. Input string must match one of
125- ! provided activation functions, otherwise it defaults to sigmoid.
126- ! If activation not present, defaults to sigmoid.
124+ ! ! Sets the activation function. Input string must match one of
125+ ! ! provided activation functions, otherwise it defaults to sigmoid.
126+ ! ! If activation not present, defaults to sigmoid.
127127 class(layer_type), intent (in out ) :: self
128128 character (len=* ), intent (in ) :: activation
129129 select case (trim (activation))
0 commit comments