The conv2’s input shape is (batch, h, w, c) does not make sense to me.
the dim of input and output of conv should be (batch, c, h, w) and if it is (batch, h, w, c) there will occur an error.
class model(nn.Module):
    def __init__(self):
        super(model, self).__init__()
        self.conv1 = nn.Conv2d(3, 5, kernel_size=3, padding=1)
        self.fc1 = nn.Linear(5, 10)
        self.fc2 = nn.Linear(10, 5)
        self.conv2 = nn.Conv2d(5, 3, kernel_size=3, padding=1)

    def forward(self, input):
        output = self.conv1(input)
        output = self.fc1(output)
        output = self.fc2(output)
        output = self.conv2(output)
        return output


a = torch.randn(size=(1, 3, 5, 5))
model = model()
output = model(a)
print(output.shape)