Clipping the tensor values to in some range

how can i clip my tensor to given range. is there any function like theano.tensor.clip in theano?

2 Likes

Have a look at torch.clamp http://pytorch.org/docs/master/torch.html?#torch.clamp

6 Likes

Thanks a lot. It helped.

Having same names for functions that are available for Numpy would make sense.

4 Likes

is this operation in place or not?

Both version are available.

torch.clamp: not in-place
torch._clamp: In-place version of clamp()

2 Likes