Skip to content

Commit f686950

Browse files
committed
Initializing recurrent kernel and states
1 parent ff1c392 commit f686950

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/nf/nf_rnn_layer_submodule.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,18 @@ module subroutine init(self, input_shape)
131131
call random_normal(self % weights)
132132
self % weights = self % weights / self % input_size
133133

134+
! Recurrent weights are a 2-d square array of shape this layer size.
135+
! Each neuron is adjusted by each state times a recurrent weight.
136+
allocate(self % recurrent(self % output_size, self % output_size))
137+
call random_normal(self % recurrent)
138+
self % recurrent = self % recurrent / self % output_size
139+
134140
! Broadcast weights to all other images, if any.
135141
call co_broadcast(self % weights, 1)
136142

143+
allocate(self % state(self % output_size))
144+
self % state = 0
145+
137146
allocate(self % biases(self % output_size))
138147
self % biases = 0
139148

0 commit comments

Comments
 (0)