Which PyTorch version did you install on Google Colab?
From the error message it looks like you called
x = torch.tensor([51, 2, 3, 4, 5])

(lowercase t in tensor)
This call is available since version 0.4.0.
In previous versions you had to use the Tensor class (uppercase T).
Could you try that?