You should also detach the tensor from the computational graph if it requires grad else gradients will be calculated for both that may lead to OOM issues.
x = torch.tensor([1.,2.,3.], requires_grad=True)
y = x.detach().clone()
y.requires_grad = True