Try to change this:
self.layer1 = nn.Sequential(
            nn.Conv2d(256, 256, 3,padding =1),
            nn.Conv2d(256, 256, 3,padding =1),
            nn.Conv2d(256, 256, 1,padding =1),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
        )

Into this:
self.layer1 = nn.Sequential(
            nn.Conv2d(1, 256, 3,padding =1),
            nn.Conv2d(256, 256, 3,padding =1),
            nn.Conv2d(256, 256, 1,padding =1),
            nn.ReLU(),
            nn.MaxPool2d(kernel_size=3, stride=1, padding=1)
        )

The first nn.Conv2d layer in self.layer1 expected 256 channels as input ( nn.Conv2d(256, 256, 3,padding =1), hence, the error. Change it to nn.Conv2d(1, 256, 3,padding =1) should resolve the error.