PyTorch Pocket Reference

Errata for PyTorch Pocket Reference

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted

In 2. Tensor Chapter, Tensor Operations section, Indexing, Slicing, Combining, and Splitting Tensors subsection, the third code example:

The output of print(x.view((2,4))) should be

tensor([[1, 2, 3, 4],
[5, 6, 7, 8]])


tensor([[1, 3, 5, 7],
[2, 4, 6, 8]])

Belal Nwiran  Jun 21, 2021 
Printed Page page 34
end of 2nd paragraph

The text says: "Some examples of similarity functions include [...], and `rand_int_like()`."

The function `rand_int_like()` does not exist in PyTorch; the function name should be `randint_like()`.

Arthur Thuy  May 15, 2023 
Printed Page 13
Code snipped

url = url = ... => url = ...

Andreas Husch  Apr 13, 2023 
Printed Page 30
4th paragraph

x.s_cuda => x.is_cuda

jh eun  Apr 23, 2022 
Other Digital Version 125
Sample code

The author finds the loss value in the following way.

running_loss += loss.item()/inputs.size(0)

But on page 109 of the book, the Loss value is calculated by the following method.

running_loss += loss.item()

What is the difference between the two methods?

YoheiMiyamoto  Aug 10, 2021 
PDF Page 149
last paragraph

"SDG" must be "SGD"
(Also in the index on page 288.)

frank langenau  Sep 10, 2021