Although the dataset isn't yet in the book's repo. I was able to download it without much hassle since you provided the source. I made sure I was using the right one by checking it's dimensions. Everything worked fine until the following line:
daily_bikes = bikes.view(1, 24, bikes.shape[1])
This line attempts to break the dataset into batches of daily (24 hours) segments. However this produces the following error:
RuntimeError: invalid argument 2: size '[1 x 24 x 17]' is invalid for input with 295443 elements
My guess: The storage is holding 295443 elements. If we try to divide that by the other two dimensions (24*17) the result is a decimal number. So inferring the first dimension via 1 won't work?
Solution: If we remove the last 3 rows from the dataset, the total number of elements in storage is reduced to 295392, which is divisible by the other two dimensions (24*17).
total_elements = 295443
for i in range(295443):
total_elements = 17
if total % (24*17) == 0:
print(total)
print(i)
break
Now the line works as intended. I imagine you had prepped the raw data from the source so it would just work, but you forgot to add it to the repo. ;)
bikes = bikes[sorted_row_idxs]
bikes_test = bikes[:3, :]
bikes_test = bikes_test.view(1, 24, bikes.shape[1])
