Possible solution:
zero_tensor = torch.zeros(input.size())
torch.where(input > min, input, zero_tensor)
torch.where(input < max, input, zero_tensor)

where() 11 is only available in 0.4 or higher versions.