nn.BCELoss expects FloatTensors for both the input and output.
As you are using nn.CrossentropyLoss I think you should use torch::log_softmax and torch::nll_loss as your criterion.
I can’t find the CrossEntropyLoss on the C++ side.