Skip to content

Commit f40eb22

Browse files
committed
Enable forward propagation for maxpool2d layer
1 parent 1192ef0 commit f40eb22

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/nf_layer_submodule.f90

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ pure module subroutine forward(self, input)
5858
call this_layer % forward(prev_layer % output)
5959
end select
6060

61+
type is(maxpool2d_layer)
62+
63+
! Input layers permitted: input3d, conv2d, maxpool2d
64+
select type(prev_layer => input % p)
65+
type is(input3d_layer)
66+
call this_layer % forward(prev_layer % output)
67+
type is(conv2d_layer)
68+
call this_layer % forward(prev_layer % output)
69+
type is(maxpool2d_layer)
70+
call this_layer % forward(prev_layer % output)
71+
end select
72+
6173
end select
6274

6375
end subroutine forward

src/nf_maxpool2d_layer.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module subroutine init(self, input_shape)
4646
integer, intent(in) :: input_shape(:)
4747
end subroutine init
4848

49-
module subroutine forward(self, input)
49+
pure module subroutine forward(self, input)
5050
class(maxpool2d_layer), intent(in out) :: self
5151
real, intent(in) :: input(:,:,:)
5252
end subroutine forward

src/nf_maxpool2d_layer_submodule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module subroutine init(self, input_shape)
3535
end subroutine init
3636

3737

38-
module subroutine forward(self, input)
38+
pure module subroutine forward(self, input)
3939
implicit none
4040
class(maxpool2d_layer), intent(in out) :: self
4141
real, intent(in) :: input(:,:,:)

0 commit comments

Comments
 (0)