RuntimeError: inconsistent tensor size

Hi, when I train CNN, I got error message below:

$ python train.py

0 0.39379167556762695
1 0.3715594410896301
2 0.21380575001239777
3 0.18399034440517426
4 0.14919331669807434
5 0.3483908176422119
6 0.261790931224823
7 0.3059869706630707
8 0.3544842600822449
9 0.3003101348876953
10 0.28798148036003113
11 0.2801303565502167
12 0.17284557223320007
13 0.15419822931289673
14 0.18459680676460266
15 0.1608618199825287
Traceback (most recent call last):
  ...
RuntimeError: inconsistent tensor size, expected tensor [3 x 384 x 256]
 and src [1 x 384 x 256] to have the same number of elements, but got 
294912 and 98304 elements respectively at /opt/conda/conda-bld/pytor
ch-cpu_1515613813020/work/torch/lib/TH/generic/THTensorCopy.c:86

I’m sorry but I can’t show you the running code.

I tried several time but this problem only occurs on 15th epoch.
So I guess this is related to illegal format of input image which is sampled on 15th epoch. Is this right?
and When the code encounters the illegal format image, how can I ignore or skip it?

Thanks.

The error message is very clear. You even hid the trace so I can’t know which call errors, but it seems to require two input tensors to have same numel. You can check that and skip if you want.

As you said this is simple problem and solved.Thanks.