This error seems to be raised in the self.last_linear layer, which creates this shape mismatch.
E.g. this code snippet would raise the same error:
input = torch.randn(16, 4096)
weight = torch.randn(1024, 3)
torch.matmul(input, weight)
> RuntimeError: size mismatch, m1: [16 x 4096], m2: [1024 x 3] at ..\aten\src\TH/generic/THTensorMath.cpp:41

Most likely the in_features of self.last_linear are wrongly defined and you would have to change them to 4096.