pytorch size mismatch, m1 m2 code example
Example 1: RuntimeError: size mismatch, m1: [1536 x 3], m2: [4096 x 101] at /opt/conda/conda-bld/pytorch_1587428398394/work/aten/src/TH/generic/THTensorMath.cpp:41
RuntimeError: size mismatch, m1: [a x b], m2: [c x d]
Example 2: RuntimeError: size mismatch, m1: [1536 x 3], m2: [4096 x 101] at /opt/conda/conda-bld/pytorch_1587428398394/work/aten/src/TH/generic/THTensorMath.cpp:41
img = img.view(1, -1) # converts [3 x 256 x 256] to 1 x 196608
output = model(img)