So, you want the loss such that, if GT appears as 2, the loss for that node should be zero.
The weight parameter pretty much does the same thing that you want.
Here’s an example. The preds could be any 4- nodes out of the (400,200)
preds = torch.Tensor([[0.45,0.2,0.35],
                   [0.1,0.5,0.4],
                   [0.3,0.2,0.5],
                   [0.1,0.75,0.15]])

gt = torch.Tensor([0,1,2,2]).long()

criterion = nn.CrossEntropyLoss(weight = torch.Tensor([1,1,0]), reduction='none')
loss = criterion(preds, lab)
print(loss)

would give
tensor([0.9872, 0.9459, 0.0000, 0.0000])

As you see in the above code-block, the loss for a node whose ground-truth is 2 is 0, which means that if you use criterion = nn.CrossEntropyLoss(weight = torch.Tensor([1,1,0])) , it would yeild a scalar loss equivalent to 0.9665, the average of [0.9872, 0.9459], instead of yielding a scalar loss of 0.48335, the average of [0.9872, 0.9459, 0, 0].
This is what you want right ? Or am I missing something ?