OpenNMT translate - RuntimeError: in-place operations can be only used on variables that don't share storage with any other variables, but detected that there are 2 objects sharing it

Hi,

I am getting the RuntimeError when using translate.py in OpenNMT code. I have check related thread which suggest using x[i, j], but this is already used. Following is the error log:

OpenNMT-py/onmt/modules/GlobalAttention.py:133: UserWarning: mask is not broadcastable to self, but they have the same number of elements. Falling back to deprecated pointwise behavior.
a_t.data.masked_fill_(self.mask, -float(‘inf’))
Traceback (most recent call last):
File “translate .py”, line 176, in
main()
File “translate .py”, line 110, in main
= translator.translate(srcBatch, tgtBatch)
File “OpenNMT-py/onmt/Translator .py”, line 253, in translate
pred, predScore, attn, goldScore = self.translateBatch(batch)
File “/OpenNMT-py/onmt/Translator .py”, line 192, in translateBatch
out[b, v] += c_attn_t[b, c]
File “/python2.7/site-packages/torch/autograd/variable.py”, line 817, in iadd
return self.add_(other)
File “python2.7/site-packages/torch/autograd/variable.py”, line 322, in add_
return self._add(other, True)
File “pytorch/local/lib/python2.7/site-packages/torch/autograd/variable.py”, line 313, in _add
return Add.apply(self, other, inplace)
RuntimeError: in-place operations can be only used on variables that don’t share storage with any other variables, but detected that there are 2 objects sharing it

Thanks