I don’t really understand TensorFlow’s softmax_cross_entropy_with_logits. It could be similar to http://pytorch.org/docs/master/nn.html#torch.nn.CrossEntropyLoss 203. Please let me know if this is what you’re looking for.