GaoYang-Thu:

Since PyTorch does not provide the CrossEntropy loss function between those two tensors


Well, why not using the Binary Cross Entropy Loss.
criterion =  criterion = nn.BCEWithLogitsLoss()
...
...
loss = criterion(y_prediction, target)

Not sure if I am missing something here?