I have MNIST images [shape:100*784 (batch size is 100)]
and after my first encoder, output shape is 100 * 120.
With this output I want forward to this second encoder.
but RuntimeError: Expected 4-dimensional input for 4-dimensional weight
occurs.
Do I have to reshape 100*120 -> something 4-dimensional ? or anyway to solve this error?
> class Encoder(nn.Module):
> def __init__(self):
> super(Encoder, self).__init__()
> self.extractor1 = nn.Sequential(
> nn.Conv2d(in_channels=1, out_channels=64, kernel_size=5, stride=1, padding=2),
> nn.BatchNorm2d(64),
> nn.ReLU(True),
> nn.MaxPool2d(kernel_size=2),
> )
>
> def forward(self, x):
> x = self.extractor1(x)
> x = x.view(-1, out_size)
> return x