Hi, @TigerMan
The error occurred because the target tensor required gradients.
The error message itself did not say the nn couldn’t handle sparse tensors.
Usually, loss functions like MSELoss take input and target and target's requires_gradient is assumed to be False.
I’m curious about your myloss function’s arguments because the order train_y_tensor and prediction is not common order.