Skip to content

Commit 386d409

Browse files
committed
feat: forward()
1 parent 845c2ce commit 386d409

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/nf/nf_rnn_layer.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module nf_rnn_layer
3434
contains
3535

3636
!procedure :: backward
37-
!procedure :: forward
37+
procedure :: forward
3838
!procedure :: get_gradients
3939
procedure :: get_num_params
4040
procedure :: get_params

src/nf/nf_rnn_layer_submodule.f90

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ pure module subroutine forward(self, input)
4141
class(rnn_layer), intent(in out) :: self
4242
real, intent(in) :: input(:)
4343

44-
self % z = matmul(input, self % weights) + self % biases
45-
self % output = self % activation % eval(self % z)
44+
self % z = matmul(input, self % weights) &
45+
+ matmul(self % state, self % recurrent) &
46+
+ self % biases
47+
self % state = self % activation % eval(self % z)
48+
self % output = self % state
4649

4750
end subroutine forward
4851

0 commit comments

Comments
 (0)