The problem of nan

Is there a way to convert the parameter nan to 0?at the same time,do not damage the backward.

yes you can do:

weight[weight.ne(weight)] = 0

where weight is your parameter Tensor from which you want to get rid of nans.

1 Like

Hi,

For some reason the following isn’t working for me:

X[X.ne(X)] = 0

where X is a Variable.

I keep getting:

AssertionError: MaskedFill can’t differentiate the mask

Any suggestions?

1 Like