Liangzhi_Tang:

what do you mean by “clamped x2”


I meant this line of your code:
y2 = torch.clamp(x2, -1.0, 1.0)




 Liangzhi_Tang:

if min and max are the same, it means the behavior of clamp and hardtanh are identical, am I right?


Yes, this is what it looks like to me.