AttributeError: 'tuple' object has no attribute 'backward'
predictor = Predictor(n_vocab, n_labels, embed_dim, hidden_dim, dropout)
model = Classifier(predictor, n_labels)
model.predictor.load_glove(embedding_path, train_word2id)
optimizer = optimizers.SGD()
optimizer.setup(model)
updater = training.StandardUpdater(train_iter, optimizer)
trainer = training.Trainer(updater, (20, 'epoch'), out='result')
# trainer.extend(extensions.Evaluator(test_iter, model))
# trainer.extend(extensions.LogReport())
# trainer.extend(extensions.PrintReport(['epoch','main/accuracy', 'validation/accuracy']))
# trainer.extend(extensions.ProgressBar())
trainer.run()
'---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-e8eadb847f69> in <module>()
43 # trainer.extend(extensions.PrintReport(['epoch','main/accuracy', 'validation/accuracy']))
44 # trainer.extend(extensions.ProgressBar())
---> 45 trainer.run()
/Users/kurt/anaconda/lib/python3.6/site-packages/chainer/training/trainer.py in run(self)
294 self.observation = {}
295 with reporter.scope(self.observation):
--> 296 update()
297 for name, entry in extensions:
298 if entry.trigger(self):
/Users/kurt/anaconda/lib/python3.6/site-packages/chainer/training/updater.py in update(self)
175
176 def update(self):
--> 177 self.update_core()
178 self.iteration += 1
179
/Users/kurt/anaconda/lib/python3.6/site-packages/chainer/training/updater.py in update_core(self)
190 optimizer.update(loss_func, **in_arrays)
191 else:
--> 192 optimizer.update(loss_func, in_arrays)
193
194 def serialize(self, serializer):
/Users/kurt/anaconda/lib/python3.6/site-packages/chainer/optimizer.py in update(self, lossfun, *args, **kwds)
530 else:
531 self.target.zerograds()
--> 532 loss.backward()
533 del loss
534
AttributeError: 'tuple' object has no attribute 'backward''
variable([ 0.68693405])
<class 'chainer.variable.Variable'> ()
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
<ipython-input-1-8a190db1d7e0> in <module>()
--
You received this message because you are subscribed to the Google Groups "Chainer User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chainer+u...@googlegroups.com.
To post to this group, send email to cha...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chainer/5fcdbea8-2e53-462c-ad12-0a17d51468cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.