Skip to content

Commit 4e234e4

Browse files
committed
Rename currentDelta to deltaAccumulator
1 parent 4c9249a commit 4e234e4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

CumulativeTape/src/main/scala/com/thoughtworks/deeplearning/CumulativeTape.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ object CumulativeTape {
4848

4949
trait MonoidTape extends CumulativeTape {
5050

51-
private var currentDelta: Delta = monoid.empty
51+
private var deltaAccumulator: Delta = monoid.empty
5252

5353
/**
5454
* Performs the underlying backward pass with all `outputDelta`s that previously received from [[forceBackward]].
@@ -59,23 +59,23 @@ object CumulativeTape {
5959

6060
override protected final def flush(): Unit = {
6161
rawBackward(synchronized {
62-
val delta = currentDelta
63-
currentDelta = monoid.empty
62+
val delta = deltaAccumulator
63+
deltaAccumulator = monoid.empty
6464
delta
6565
})
6666
}
6767

6868
override final def forceBackward(outputDelta: Delta) = {
6969
synchronized {
70-
currentDelta = currentDelta |+| outputDelta
70+
deltaAccumulator = deltaAccumulator |+| outputDelta
7171
}
7272
Future(())
7373
}
7474
}
7575

7676
trait SemigroupTape extends CumulativeTape {
7777

78-
private var currentDelta: Option[Delta] = None
78+
private var deltaAccumulator: Option[Delta] = None
7979

8080
/**
8181
* Performs the underlying backward pass with all `outputDelta`s that previously received from [[forceBackward]].
@@ -86,15 +86,15 @@ object CumulativeTape {
8686

8787
override protected final def flush(): Unit = {
8888
synchronized {
89-
val delta = currentDelta
90-
currentDelta = None
89+
val delta = deltaAccumulator
90+
deltaAccumulator = None
9191
delta
9292
}.foreach(rawBackward)
9393
}
9494

9595
override final def forceBackward(outputDelta: Delta) = {
9696
synchronized {
97-
currentDelta |+|= Some(outputDelta)
97+
deltaAccumulator |+|= Some(outputDelta)
9898
}
9999
Future(())
100100
}

0 commit comments

Comments
 (0)