Thankyou for your reply.
The tensor x is between 0 to 1. With torch.min i checked it is 0. But its low light data. So average value of x is 1e-4 or 1e-3 and no greater 1e-2. rarely it would reach 1e-1.
But what ever it might why using clamp gives nan and nn.Threshold does where th job of both is to clamp any value less than 0.1 to 0.1 for alpha.