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
weight is your parameter Tensor from which you want to get rid of nans.
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