Skip to content

Commit c3f93cf

Browse files
committed
fix: Recurrent is actually a square matrix
Each neuron is affected by all states. With this change the forward procedure is working correctly. I verified a couple of test cases.
1 parent ef49903 commit c3f93cf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/nf/nf_rnn_layer.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module nf_rnn_layer
2020
integer :: output_size
2121

2222
real, allocatable :: weights(:,:)
23-
real, allocatable :: recurrent(:)
23+
real, allocatable :: recurrent(:,:)
2424
real, allocatable :: biases(:)
2525
real, allocatable :: z(:) ! matmul(x, w) + b
2626
real, allocatable :: state(:)

src/nf/nf_rnn_layer_submodule.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ module subroutine init(self, input_shape)
137137
! Broadcast weights to all other images, if any.
138138
call co_broadcast(self % weights, 1)
139139

140-
allocate(self % recurrent(self % output_size))
140+
allocate(self % recurrent(self % output_size, self % output_size))
141141
call random_normal(self % recurrent)
142142
self % recurrent = self % recurrent / self % input_size
143143

0 commit comments

Comments
 (0)