The LogSoftmax is missing the parentheses, so no instance is created. Use this:
...
nn.Linear(512, 2).
nn.LogSoftmax()
)

Since you are dealing with a multi-class classification, use nn.NLLLoss as your criterion.