It seems you are trying to apply the binary cross entropy loss formula to the multi-class nn.CrossEntropyLoss, which won’t work.
Instead of using the -[1 * (...) + (1 - y) * (...)] approach (which would be correct for the binary use case) you would have to multiply the targets directly as [y[0] * (...) + y[1] * (...) + y[2] * (...)], which would then reduce to y[0] * (...) only since only a single class is active.