MaskFill is nondifferentiable almost everywhere wrt to the mask. So your x > 0.0 can’t require gradient. The filled tensor, x here however is differentiable almost everywhere so that’s fine.
I remember that we fixed variable comparison results (the byte tensor) requiring gradient. So you can try update, or just do x[(x <= 0.0).detach()] = 1