11module nf_conv2d_layer
22
3- ! ! This is a placeholder module that will later define a concrete conv2d
4- ! ! layer type.
3+ ! ! This modules provides a 2-d convolutional `conv2d_layer` type.
54
65 use nf_base_layer, only: base_layer
76 implicit none
@@ -17,9 +16,9 @@ module nf_conv2d_layer
1716 integer :: window_size
1817 integer :: filters
1918
20- real , allocatable :: biases(:) ! as many as there are filters
21- real , allocatable :: kernel(:,:,:,:)
22- real , allocatable :: output(:,:,:)
19+ real , allocatable :: biases(:) ! size( filters)
20+ real , allocatable :: kernel(:,:,:,:) ! filters x channels x window x window
21+ real , allocatable :: output(:,:,:) ! filters x output_width * output_height
2322
2423 contains
2524
@@ -31,6 +30,7 @@ module nf_conv2d_layer
3130
3231 interface conv2d_layer
3332 pure module function conv2d_layer_cons(window_size, filters, activation) result(res)
33+ ! ! `conv2d_layer` constructor function
3434 integer , intent (in ) :: window_size
3535 integer , intent (in ) :: filters
3636 character (* ), intent (in ) :: activation
@@ -59,9 +59,13 @@ pure module subroutine forward(self, input)
5959 end subroutine forward
6060
6161 module subroutine backward (self , input , gradient )
62+ ! ! Apply a backward pass on the `conv2d` layer.
6263 class(conv2d_layer), intent (in out ) :: self
64+ ! ! A `conv2d_layer` instance
6365 real , intent (in ) :: input(:,:,:)
66+ ! ! Input data (previous layer)
6467 real , intent (in ) :: gradient(:,:,:)
68+ ! ! Gradient (next layer)
6569 end subroutine backward
6670
6771 end interface
0 commit comments