I have followed your forward function, but I still get the same error.
I called all parameter in file test.py  like this:
import torch
import torch.nn as nn

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
class Flatten(nn.Module):
    def forward(self, input):
        return input.view(input.size(0), -1)

class ConvNet(nn.Module):
    def __init__(self,num_classes=8):
        super(ConvNet,self).__init__()
        self.layer1 = nn.Sequential(
            nn.Conv2d(1,64,kernel_size=7),                                          
            nn.BatchNorm2d(64),
            nn.ReLU(),
            nn.AvgPool2d(kernel_size=2,stride=2)                                     
        )
        self.layer2 = nn.Sequential(
            nn.Conv2d(64,128,kernel_size=7,stride=2),                               
            nn.BatchNorm2d(128),
            nn.ReLU(),
            nn.AvgPool2d(kernel_size=2,stride=2)                                    
        )
        self.layer3 = nn.Sequential(
            nn.Conv2d(128,256,kernel_size=3),                                        
            nn.BatchNorm2d(256),
            nn.ReLU(),
            nn.AvgPool2d(kernel_size=2,stride=2)                                    
        )
        self.layer4 = nn.Sequential(                                                
            nn.Conv2d(256,512,kernel_size=3),                                        
            nn.BatchNorm2d(512),
            nn.ReLU(),
            nn.AvgPool2d(kernel_size=2,stride=2),                                   
            nn.BatchNorm2d(512)                                     
        )
        self.hidden = nn.Linear(2*2*512,1024)
        self.drop = nn.Dropout(0.6)
        self.dense1 = nn.Sequential(
            nn.Linear(1024,256),
            nn.ReLU(),
            nn.Dropout(0.25)
        )
        self.dense2 = nn.Sequential(
            nn.Linear(256,64),
            nn.ReLU()
        )
        self.fc1 = nn.Linear(64,32)
        self.fc = nn.Linear(32,num_classes)

    def forward(self,x):
        out = self.layer1(x)
        out = self.layer2(out)
        out = self.layer3(out)
        out = self.layer4(out)
        out = Flatten()(out)
        out = nn.ReLU()(self.hidden(out))
        out = self.drop(out)
        out = self.dense1(out)
        out = self.dense2(out)
        out = nn.ReLU()(self.fc1(out))
        out = self.fc(out)
        return out

model = ConvNet(8).to(device)
model.load_state_dict(torch.load('model.pt'))
removed = list(model.children())[:-1]
new_model= torch.nn.Sequential(*removed)
with torch.no_grad():
     image_trans = torch.from_numpy(test_image.astype(np.float32)).to(device)
     prediction = new_model(image_trans)

Error:
Traceback (most recent call last):
  File "test.py", line 121, in <module>
    prediction = new_model(image_trans)
  File "C:\ProgramData\Anaconda3\envs\deep\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\deep\lib\site-packages\torch\nn\modules\container.py", line 100, in forward
    input = module(input)
  File "C:\ProgramData\Anaconda3\envs\deep\lib\site-packages\torch\nn\modules\module.py", line 532, in __call__
    result = self.forward(*input, **kwargs)*
  File "C:\ProgramData\Anaconda3\envs\deep\lib\site-packages\torch\nn\modules\linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)
  File "C:\ProgramData\Anaconda3\envs\deep\lib\site-packages\torch\nn\functional.py", line 1372, in linear
    output = input.matmul(weight.t())
RuntimeError: size mismatch, m1: [1024 x 2], m2: [2048 x 1024] at C:/w/1/s/tmp_conda_3.8_075429/conda/conda-bld/pytorch_1579852542185/work/aten/src\THC/generic/THCTensorMathBlas.cu:290