Clamping leaf tensor without using .data

I would cite @albanD in here since this is still relevant for PyTorch 4,0 and later.