apsvieira:

input = input.masked_fill(A_array, 0)


Thanks, It worked well on pytorch 0.4 but it has error in pytorch 0.3.1. Have you ever seen the error

File “/usr/local/lib/python2.7/dist-packages/torch/autograd/variable.py”, line 78, in getitem
return Index.apply(self, key)
File “/usr/local/lib/python2.7/dist-packages/torch/autograd/_functions/tensor.py”, line 89, in forward
result = i.index(ctx.index)
TypeError: Performing basic indexing on a tensor and encountered an error indexing dim 2 with an object of type torch.cuda.ByteTensor. The only supported types are integers, slices, numpy scalars, or if indexing with a torch.cuda.LongTensor or torch.cuda.ByteTensor only a single Tensor may be passed.