You can try below code. just do some boolean indexing in the data. After comparator, do the replacement in the data. You will get the idea.
import torch

input = torch.tensor([[0,3,2,-1],[2,1,3,4]],dtype = torch.float)
input_clamp = torch.Tensor([2,3])

tiled = input_clamp.repeat(4,1).t()

bigger = input > tiled
input[bigger] = tiled[bigger]

print(input)```