Calling backward more than rho times on an nn.Recurrent module can lead to undesired/undocumented behavior, when really it should be explicitly guarded against and cause an error. See the following code, which
sets rho = 1
Calls forward() 4 times
Calls backward() 3 times
After 4 calls to forward(), there are only 2 clones of the recurrent module in the sharedClones. Calling backward 2 times affects these 2 clones, but a third call to backward will create a clone of the recurrentModule and call backward on it.
Calling backward more than
rho
times on annn.Recurrent
module can lead to undesired/undocumented behavior, when really it should be explicitly guarded against and cause an error. See the following code, whichforward()
4 timesbackward()
3 timesAfter 4 calls to forward(), there are only 2 clones of the recurrent module in the
sharedClones
. Callingbackward
2 times affects these 2 clones, but a third call tobackward
will create a clone of therecurrentModule
and callbackward
on it.