I colab I can’t get the value of a pytorch tensor that is on tpu TPU and requires_grad.
When I write in colab:
import torch_xla.core.xla_model as xm
device = xm.xla_device()
t = torch.tensor([1.], requires_grad=True).to(device)
print(t)
It’s ok but if I do:
import torch_xla.core.xla_model as xm
device = xm.xla_device()
t1 = torch.tensor([1.], requires_grad=True).to(device)
t2 = torch.tensor([1.], requires_grad=True).to(device)
t3 = t1 + t2
print(t3)
Colab freezes indefinetly it also happends when I use t.item() or t.cpu().item() I need this to get the value out of the tensor.
New contributor
A D is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.