At first, I must say that I ran your code in an IDE because there is no difference; however, I checked both of them.
Then you are using  the following code in a new terminal:
   import torch
   model = torch.load('model.pkl')

Running the above code returns the error. But I could see that if you include the definition of your class (simple), there will not be error. I mean write your code as the following:
class simple(nn.Module):
def init(self):
    super(simple, self).init()
    self.net = nn.Linear(28 * 28, 2)

def forward(self, x):
    x = np.array(x)
    x = torch.from_numpy(x)
    x = Variable(x)
    x = x.view(1,1,28,28)
    batch_size = x.size(0)
    x = x.view(batch_size, -1)
    output = self.net(x.float())
    return output
model = torch.load('model.pkl')

The result in an IDE and Terminal are the same.
Please check it.
I hope my help could be helpful.