The first two layers of your model are working fine:
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(in_channels=3,out_channels=64,kernel_size=(3,3),stride=(2,2),padding=(1,1))
        self.bn1 = nn.BatchNorm2d(num_features=64)
        
    
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        return x

model = Net()
x = torch.randn(2, 3, 24, 24)
out = model(x)

However, note that you are overriding the batchnorm layers by using the same variable name:
self.conv1 = nn.Conv2d(in_channels=3,out_channels=64,kernel_size=(3,3),stride=(2,2),padding=(1,1))
self.bn1 = nn.BatchNorm2d(num_features=64)
[...]
self.conv2 = nn.Conv2d(in_channels=64,out_channels=64,kernel_size=(3,3),stride=(2,2),padding=(1,1))
self.bn1 = nn.BatchNorm2d(num_features=64)

Here self.bn1 is reused, which won’t raise an error, since both layers are using the same number of feature, but I guess you might be overriding the layer again in a missing code snippet, which would explain the shape mismatch.