Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 5eedf8c

Browse files
Shashi456marcrasi
authored andcommitted
Minor error in rnn implementation (#519)
1 parent 8f06bee commit 5eedf8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/TensorFlow/Layers/Recurrent.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ extension RNNCellOutput: EuclideanDifferentiable
5252

5353
/// A recurrent neural network cell.
5454
public protocol RNNCell: Layer
55-
where Input == RNNCellInput<TimeStepInput, State>,
55+
where Input == RNNCellInput<TimeStepInput, State>,
5656
Output == RNNCellOutput<TimeStepOutput, State> {
5757
/// The input at a time step.
5858
associatedtype TimeStepInput: Differentiable
@@ -324,7 +324,7 @@ public struct RNN<Cell: RNNCell>: Layer {
324324
reversed𝛁inputs.reserveCapacity(timeStepCount)
325325
for (𝛁output, backpropagator) in zip(𝛁outputs.base, backpropagators).reversed() {
326326
let (new𝛁cell, 𝛁input) = backpropagator(.init(output: 𝛁output, state: 𝛁state))
327-
𝛁cell = new𝛁cell
327+
𝛁cell += new𝛁cell
328328
𝛁state = 𝛁input.state
329329
reversed𝛁inputs.append(𝛁input.input)
330330
}

0 commit comments

Comments
 (0)