torch.clamp() does not work properly
The environment I used was google colaboratory
I ran torch.clamp() according to the official documentation
https://pytorch.org/docs/master/generated/torch.clamp.html 6
working program
print(torch.__version__)
a = torch.randn(4)
print(a)
torch.clamp(a, min=-0.5, max=0.5)
print(a)

The results obtained
1.5.1+cu101
tensor([-0.8323, -0.0443,  0.4641,  0.0824])
tensor([-0.8323, -0.0443,  0.4641,  0.0824])

If it works like the document, the original result is tensor([-0.5, -0.0443, 0.4641, 0.0824])
What’s wrong with that?
Is this a bug?
I want to set constraints on weight parameters like keras.constraints
I can’t do it because torch.clamp() doesn’t work properly.

  
    
    
    Set constraints on parameters or layers 
  
  
    Hi, are there any ways in Pytorch to set the range of parameters or values in each layer? For example, is it able to constrain the range of the linear product Y = WX to [-1, 1]? If not, how about limiting the range of the weight? 
I noticed in Karas, user can define this by setting constraints. Any equivalence in Pytorch? 
Thanks!