I have a tensor t_p of shape (N,6). I want to clamp 0 and 4 column to min=0.0, max=1.0
I tried this:
        t_p[:,0] = torch.clamp(t_p[:,0],min=0.0, max=1.0) 
        t_p[:,4] = torch.clamp(t_p[:,4],min=0.0, max=1.0)

But during the backward pass I am having an error:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
How can I do this efficiently without doing an inplace operation??
Any suggestion would be helpful