Programming pytorch with DL book errors


I am trying to follow “Programming pytorch for deep learning” book & having hurdles every now & then.
I spinned up a AWS Dlami instance but never got to SSH from local machine and quit like 2-3 times.

I got to next step the third time only to fail again in chapter one to download the dataset from given excel file(a python script is given by author to download the Training:Test dataset of fish:cat.
I quit again that time like a month ago.
Got a bill of 60$ from AWS :frowning:

Today, i started again from scratch. Spinned up a Colab google notebook for free so far :crossed_fingers:
This time i got an error right out of bat at
tensor.ones(1,2) as
“tensor not defined”
imported tensor from torch only to get a different error.
“Tensor doesn’t have ones attribute”
I Understand that Tensor function doesnt have ones method in it as per the error.
Is there a fix(i didn’t check the tensor function for the method) for this error?

Anybody else who finished the “Programming pytorch with DL book”?


tensor.ones is not a valid method and you would most likely want to use torch.ones instead.

1 Like

Yes, that worked. The book Programming PyTorch has tensor.ones in examples. May be its a Typo.