Skip to content

Commit ea0012a

Browse files
committed
Guard against bad dropout rate
1 parent a99d800 commit ea0012a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/nf/nf_layer_constructors_submodule.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ end function dense
6969
module function dropout(rate) result(res)
7070
real, intent(in) :: rate
7171
type(layer) :: res
72+
if (rate < 0 .or. rate > 1) &
73+
error stop 'rate must be between 0 and 1 in a dropout layer'
7274
res % name = 'dropout'
7375
allocate(res % p, source=dropout_layer(rate))
7476
end function dropout
@@ -81,7 +83,6 @@ module function flatten() result(res)
8183
end function flatten
8284

8385

84-
8586
module function input1d(layer_size) result(res)
8687
integer, intent(in) :: layer_size
8788
type(layer) :: res

0 commit comments

Comments
 (0)