I tried to using Show And Tell model with COCO dataset. But, at one point my Torch program paused. Can anyone fix my code? Here is my code which causes the training to pause.
def to_var(x, volatile=True):
if torch.cuda.is_available():
x = x.cuda()
return Variable(x, volatile=volatile)
And the warning was below.
utils.py:114: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. return Variable(x, volatile=volatile)
In the new version of Pytorch
volatile
is removed and alsoVariable
is not necessary. Any computation of a tensor withvolatile=True
wouldn’t be tracked byautograd
. So your function can be rewritten as:Output: