Note at Section 03, using a trick for input and output #68
Replies: 3 comments
-
Thank you for this! I didn't realise. I'm going to add this as an issue and inspect it shortly. See the issue here: #71 |
Beta Was this translation helpful? Give feedback.
-
@aronvandepol Maybe this is not that needed i have a solution to it. (NOTE: this solution is only tested on food101 dataset mini) We can just multiply both input and output shape of the model in an example (This totally works):
@mrdbourke Does this method solve the problem? |
Beta Was this translation helpful? Give feedback.
-
Yo! Did you unsqueeze an input tensor? Cause I had same problem as you have explained and found a solution similar to yours, but when i ran it, i found that the output of the model is 10x10 matrix, not a vector. So after a few more attempts to understand where I went wrong, i finally got an answer. so keep in mind the batch_num in an input tensor. My PyTorch version is |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
With the pytorch version 1.11 (and 1.12), the trick that Daniel uses (
hidden_units*7*7
) doesn;'t work. It worked I believe because the output in 1.10 of Conv_layer_2 =[1,10,7,7]
. Multiplying each unit10*7*7
=490
and delivers[1,490]
and thus solving this by usinghidden_units*7*7
works in 1.10.In 1.11 and 1.12, the output of conv_layer_2 is however is
[10, 7, 7]
, leading to7*7
and a size of[10*49]
. Hence, you cannot solve the input by doinghidden*7*7
(results in 490) but rather, simply7*7
.thus the linear layer becomes:
nn.Linear(in_features=7*7, out_features=output_shape)
Using this the shapes match and it will work on a single image,
Yet when training you will need the
hidden*7*7
setup as it wont work otherwise.Beta Was this translation helpful? Give feedback.
All reactions