Hey @KFrank My problem was that my ‘batch’ wasn’t really a batch (it was a single training example), as I’m doing online learning.
The following seemed to have fixed that, (although I’m not exactly clear on the usage of view and unqueeze yet):
torch::Tensor TorchMLP::test(torch::Tensor x) {
    x = x.view(784);
    x = torch::relu(h->forward(x));
    x = torch::sigmoid(out->forward(x));
    return x.unsqueeze(-1);
}

But I got that very unhelpful error, so I’ll file a bug report for it. Thanks for your help.