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[] = 0

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

1 Like


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

X[] = 0

where X is a Variable.

I keep getting:

AssertionError: MaskedFill can’t differentiate the mask

Any suggestions?

1 Like