hughperkins / pytorch

Python wrappers for torch and lua
BSD 2-Clause "Simplified" License
432 stars 70 forks source link

Invalid argument 2: 3D or 4D input tensor expected but got: [32 x 784] #39

Open JeffreyYH opened 6 years ago

JeffreyYH commented 6 years ago

Hi Hugh, thanks for this nice software, when I run the example code of MNIST, it shows the following error,

Connected to pydev debugger (build 171.4694.67) $ Invalid argument 2: 3D or 4D input tensor expected but got: [32 x 784] at /tmp/luarocks_nn-scm-1-8028/nn/lib/THNN/generic/SpatialConvolutionMM.c:33

How to deal with it

hughperkins commented 6 years ago

the error message means it expects a tensor of dimension 32 28 28, rather than 32 * 784.