Change the layer format to a different image resolution
There is a class where everything is set to 32x32 image format Taken from here
class Net(nn.Module):
        def __init__(self):
            super().__init__()
            self.conv1 = nn.Conv2d(1, 6, 5) # here I changed the image channel from 3 to 1
            self.pool = nn.MaxPool2d(2, 2)
            self.conv2 = nn.Conv2d(6, 64, 5)
            self.fc1 = nn.Linear(64 * 5 * 5, 120)
            self.fc2 = nn.Linear(120, 84)
            self.fc3 = nn.Linear(84, 22) # here I changed the number of output neurons from 10 to 22

        def forward(self, x):
            x = self.pool(F.relu(self.conv1(x)))
            x = self.pool(F.relu(self.conv2(x)))
            x = torch.flatten(x, 1) # flatten all dimensions except batch
            x = F.relu(self.fc1(x))
            x = F.relu(self.fc2(x))
            x = self.fc3(x)
            return x

How to change all this under resolution 96 to 96? Channel 1 (grayscale)?

At resolution 32x32 the output of conv2 is shaped (1, 64, 5, 5). On the other hand, if the input is at resolution 96x96, it will be (1, 64, 21, 21). This means fc1 needs to have 28_224 input neurons.
&gt;&gt;&gt; self.fc1 = nn.Linear(64 * 21 * 21, 120)

Alternatively, you can use nn.LazyLinear which will infer this number for you, based on the first inference.
&gt;&gt;&gt; self.fc1 = nn.Linear(120)

