When am trying to update zero values of a variable x[ x<=0.0] = 1.0 where x is a variable and x.data is of floatTensor. I get this error, ‘MaskedFill can’t differentiate the mask’ and after debugging a bit, I found that in variable.py
def setitem(self, key, value):
if isinstance(key, Variable) and type(key.data).name == ‘ByteTensor’:
if isinstance(value, Variable):
return MaskedScatter.apply(self, key, value, True)
else:
return MaskedFill.apply(self, key, value, True)
else:
return SetItem.apply(self, key, value)
It always go to the MaskedFill statement because they data of key is ByteTensor. Any suggestion as to why could this happen and how to fix it ? It would work fine with SetItem statement