Closed ethanabrooks closed 8 years ago
Use nn.Copy
to force a copy:
local feedback = nn.Sequential()
local concat = nn.ConcatTable()
feedback:add(concat)
concat:add(nn.Copy(nil, nil, true))
concat:add(nn.Copy(nil, nil, true))
feedback:add(nn.CAddTable())
Thanks! That fixed it. Could you help me understand what's going on here? nn.Recurrent
is a module that I plan to use extensively.
The problem is that nn.Recurrent assumes that the output and input are different tensors. That is why you must explicitly copy input to output if the tensor is the same.
Thanks. That's very clarifying.
Recurrent
appears to mutateConcatTable.modules
into{}
. As a result the following code:throws this error:
A few observations.
Recurrent
only throws the error on the third call. Also,feedback
does not throw the error outsideRecurrent
. Thanks for our help!