Skip to content

Commit 49c65e4

Browse files
committed
Add docstrings to the maxpool2d module
1 parent dd45cb3 commit 49c65e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/nf_maxpool2d_layer.f90

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,41 @@ module nf_maxpool2d_layer
3333

3434
interface maxpool2d_layer
3535
pure module function maxpool2d_layer_cons(pool_size, stride) result(res)
36+
!! `maxpool2d` constructor function
3637
integer, intent(in) :: pool_size
38+
!! Width and height of the pooling window
3739
integer, intent(in) :: stride
40+
!! Stride of the pooling window
3841
type(maxpool2d_layer) :: res
3942
end function maxpool2d_layer_cons
4043
end interface maxpool2d_layer
4144

4245
interface
4346

4447
module subroutine init(self, input_shape)
48+
!! Initialize the `maxpool2d` layer instance with an input shape.
4549
class(maxpool2d_layer), intent(in out) :: self
50+
!! `maxpool2d_layer` instance
4651
integer, intent(in) :: input_shape(:)
52+
!! Array shape of the input layer
4753
end subroutine init
4854

4955
pure module subroutine forward(self, input)
56+
!! Run a forward pass of the `maxpool2d` layer.
5057
class(maxpool2d_layer), intent(in out) :: self
58+
!! `maxpool2d_layer` instance
5159
real, intent(in) :: input(:,:,:)
60+
!! Input data (output of the previous layer)
5261
end subroutine forward
5362

5463
module subroutine backward(self, input, gradient)
64+
!! Run a backward pass of the `maxpool2d` layer.
5565
class(maxpool2d_layer), intent(in out) :: self
66+
!! `maxpool2d_layer` instance
5667
real, intent(in) :: input(:,:,:)
68+
!! Input data (output of the previous layer)
5769
real, intent(in) :: gradient(:,:,:)
70+
!! Gradient from the downstream layer
5871
end subroutine backward
5972

6073
end interface

0 commit comments

Comments
 (0)