問題タブ [torchvision]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
1929 参照

python - Error during training on ResNet50: Expected 4-dimensional input for 4-dimensional weight [64, 3, 7, 7], but got input of size [8, 196608] instead

python v 3.7.3, pytorch v 0.4.1, using jupyter

I am working on creating an image classifier using transfer learning with ResNet50 as the base model. I've run across an error that I don't understand how to debug, even after searching for solutions online. I'm not sure why my dimensions are so off. Any help on what to do would be appreciated. Also, any book recs on Deep Learning using Pytorch would be great :)

Code for final layer of ResNet:

code for training:

error:

EDIT: I removed images = images.view.shape[0], -1, which was converting my tensor to [8, 196608]. But now I am receiving a new error:

RuntimeError: size mismatch, m1: [8 x 8192], m2: [2048 x 256] at c:\programdata\miniconda3\conda-bld\pytorch_1532509700152\work\aten\src\th\generic/THTensorMath.cpp:2070