You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a minimal piece of code demonstrating a strange bug I have experienced.
Here, I have a typical LSTM sequence encoder. I also have a dummy class that inherits from nn.Container. The following code crashes. However, if you move the
parent:__init(self) line to go after mapper:forward(), then everything is ok. It fails in dpnn.Module:
Since the container has a member called modules, this code crashes. It seems like the self pointer is wrong here or something. Any ideas about what is going on?
require'nn'require'rnn'localvocabSize=25localembeddingDim=10localrnnHidSize=15locallstm=nn.Sequencer(nn.LSTM(embeddingDim, rnnHidSize))
localmapper=nn.Sequential():add(nn.LookupTable(vocabSize,embeddingDim)):add(nn.SplitTable(2)):add(lstm):add(nn.SelectTable(-1))
--this is a minibatch of 'sentences'localdata=torch.rand(32,16):mul(vocabSize):ceil()
localNoopContainer, parent=torch.class('nn.NoopContainer', 'nn.Container')
functionNoopContainer:__init()
parent:__init(self)
locallength=12localdd=torch.rand(32,length):mul(vocabSize):ceil()
mapper:forward(dd)
endlocalnoop=nn.NoopContainer()
The text was updated successfully, but these errors were encountered:
Below is a minimal piece of code demonstrating a strange bug I have experienced.
Here, I have a typical LSTM sequence encoder. I also have a dummy class that inherits from nn.Container. The following code crashes. However, if you move the
parent:__init(self) line to go after mapper:forward(), then everything is ok. It fails in dpnn.Module:
Since the container has a member called modules, this code crashes. It seems like the self pointer is wrong here or something. Any ideas about what is going on?
The text was updated successfully, but these errors were encountered: