as title shows,datasat is MINST. but i meet the problem that the output of model is null.
the code as follows:
the output of model is :
that’s all. I try to solve it for many times.but no solution. I’m newcomer study on pytorch. thanks for your attention.
That’s strange. I jused exactly your code and with
print(model) I get the result as expected:
(0): Conv2d(1, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(2): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(0): Linear(in_features=25088, out_features=1024, bias=True)
(3): Linear(in_features=1024, out_features=10, bias=True)
Can you post your code formatted? Maybe there are some indents wrong…
You can format your code using three backticks (`) before and after the code. Also make sure, the code you posted is indented the same way as the code you executed, because otherwise we won’t be aple to reproduce this.
you’re right.I will upload code that meet the format. but the problem not result in format. thanks for your attention.
I guess it’s because you are missing two underscores in
Currently your code just uses one underscore on each side.
You are right, I totally missed this, and corrected it without noticing, since I couldn’t copy the code but had to retype it by myself
Automatic error detection
thanks, I have solved it according to your clue. ‘-’-‘init’-’-’.