Solved by tom in post #2 
              
              
                x.clamp is not expected to take out, but per the documentation it is a bug that torch.clamp does not. 
For your case, the inplace x.clamp_ might work. 
Best regards 
Thomas