Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A code mistake in the book #36

Open
Neuerliu opened this issue Mar 4, 2023 · 2 comments
Open

A code mistake in the book #36

Neuerliu opened this issue Mar 4, 2023 · 2 comments

Comments

@Neuerliu
Copy link

Neuerliu commented Mar 4, 2023

There is a mistake on page 113 of the book.

# on page 113
predictions = torch.tensor(0.5, 1.0)
labels = torch.tensor(2.0, 1.3)

Probably what you really want to write is

predictions = torch.tensor([0.5, 1.0])
labels = torch.tensor([2.0, 1.3])

Thank you
Neuer

@newcastlea
Copy link

Page 738 of the book :
There is:
`x0 = points[0] # 4 data points
x1 = points[1][2:] # 2 data points
x2 = points[2][1:] # 3 data points

x0.shape, x1.shape, x2.shape`

But correctly, given the following code, it is:

`s0 = points[0] # 4 data points
s1 = points[1][2:] # 2 data points
s2 = points[2][1:] # 3 data points

s0.shape, s1.shape, s2.shape`

Nice book!

@benjwolff
Copy link

I add another code typo to this issue, that I found in the book (and in the notebook as well):
Page 606:

batch_hidden = final_hidden.permute(1, 0, 2)
batch.shape

Should actually be:

batch_hidden = final_hidden.permute(1, 0, 2)
batch_hidden.shape

Otherwise an incorrect tensor shape will be printed ([3, 4, 2] instead of [3, 1, 2].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants