Error Image size is [32, 128, 128] expected model size is [128 128 1 1]

akhilesh_rai: <p>Batch size = 32</p>
<pre><code class="lang-auto">  (conv1): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
  (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (relu): ReLU(inplace=True)
  (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), bias=False)
  (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (block1): Block(
    (skip): Conv2d(128, 128, kernel_size=(1, 1), stride=(2, 2), bias=False)
    (skipbn): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): SeparableConv2d(
        (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=128, bias=False)
        (pointwise): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (2): ReLU(inplace=True)
      (3): SeparableConv2d(
        (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=128, bias=False)
        (pointwise): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (4): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (5): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
    )
  )
  (block2): Block(
    (skip): Conv2d(128, 256, kernel_size=(1, 1), stride=(2, 2), bias=False)
    (skipbn): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=128, bias=False)
        (pointwise): Conv2d(128, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)
        (pointwise): Conv2d(256, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
    )
  )
  (block3): Block(
    (skip): Conv2d(256, 728, kernel_size=(1, 1), stride=(2, 2), bias=False)
    (skipbn): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False)
        (pointwise): Conv2d(256, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
    )
  )
  (block4): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block5): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block6): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block7): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block8): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block9): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block10): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block11): Block(
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): ReLU(inplace=True)
      (7): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (8): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    )
  )
  (block12): Block(
    (skip): Conv2d(728, 1024, kernel_size=(1, 1), stride=(2, 2), bias=False)
    (skipbn): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu): ReLU(inplace=True)
    (rep): Sequential(
      (0): ReLU()
      (1): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 728, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (2): BatchNorm2d(728, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (3): ReLU(inplace=True)
      (4): SeparableConv2d(
        (conv1): Conv2d(728, 728, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=728, bias=False)
        (pointwise): Conv2d(728, 1024, kernel_size=(1, 1), stride=(1, 1), bias=False)
      )
      (5): BatchNorm2d(1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (6): MaxPool2d(kernel_size=3, stride=2, padding=1, dilation=1, ceil_mode=False)
    )
  )
  (conv3): SeparableConv2d(
    (conv1): Conv2d(1024, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=1024, bias=False)
    (pointwise): Conv2d(1024, 1536, kernel_size=(1, 1), stride=(1, 1), bias=False)
  )
  (bn3): BatchNorm2d(1536, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (conv4): SeparableConv2d(
    (conv1): Conv2d(1536, 1536, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=1536, bias=False)
    (pointwise): Conv2d(1536, 2048, kernel_size=(1, 1), stride=(1, 1), bias=False)
  )
  (bn4): BatchNorm2d(2048, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (fc): Linear(in_features=2048, out_features=1000, bias=True)
) 

 for i,data in enumerate(train_loader):
        #dataset[0][0]
        #dataset = dataset[0].view(dataset[0].size(0), -1)
        image,label1,label2,label3 = data
        print(image.size())
        yhat = model(image.float()) """
</code></pre>
<p>However model doesnt take input and wants an input of size [128 128 1 1]</p>
<p>How do I give the images as input to the model?</p>

akhilesh_rai: <p><a class="mention" href="/u/tom">@tom</a> <a class="mention" href="/u/ptrblck">@ptrblck</a> please help!</p>

sdv4: <aside class="quote no-group" data-username="akhilesh_rai" data-post="1" data-topic="67472">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/akhilesh_rai/48/14229_2.png" class="avatar"> akhilesh_rai:</div>
<blockquote>
<p>(conv1): Conv2d(128, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)</p>
</blockquote>
</aside>
<p>This is saying that your input image has 128 channels, when it likely has 3 (if RGB, YCbCr, etc.) or 1 (grey scale ). Then if your batch size is 32, your input size should be (32, 3, 128, 128) for RGB images.</p>

akhilesh_rai: <p>Gor it changed number of input channels to 1</p>