Torch.clamp() where min and max are tensors of the same shape is input tensor? 
  
  
    You can use 2 torch.where operations, similarly to an answer here Clipping a tensor between two corresponding tensor values. It’s not ideal in terms of performance, but it should work.