Hi,
so it is doing exactly what i want, you are right, really thank you.
Also i tried it in my demo and i found that it is not counting loss where gt is set to this class, but it is counting loss from this place in input for the CrossEntropyLoss : [2][…][…]. If am i understand it right it is prediction for class 2, which i think is useless for me. Is there way, that i would have 3 classes, but for the loss, i would count only prediction from 2 classes?
Or should i change output from model, so it would not have 3 predictions tensors but only two? Will be then GT with 3 classes work?
I mean that:
preds = torch.Tensor(
        [[[[0.45,0.2,0.0],[0.1,0.9995,0.4],[0.3,0.2,0.5] ],
            [[0.5,0.6,0.0],[0.6,0.4,0.3],[0.0,0.1,0.9]],
            [[0.4,0.22,0.0],[0.51,0.65,0.94],[0.23,0.52,0.56]],
       ]]).float()

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

is now counting same result as if the preds tensor would be
preds = torch.Tensor(
        [[[[0.45,0.2,0.5],[0.1,0.1,0.4],[0.3,0.2,0.5] ],
            [[0.5,0.6,0.9],[0.6,0.0,0.3],[0.0,0.1,0.9]],
            [[0.4,0.22,0.9],[0.51,0.0,0.94],[0.23,0.52,0.56]],
       ]]).float()


which is really great for me.
But what i would like to achieve for my work is that it would create same result also if it would be:
preds = torch.Tensor(
        [[[[0.45,0.2,0.5],[0.1,0.1,0.4],[0.3,0.2,0.5] ],
            [[0.5,0.6,0.9],[0.6,0.0,0.3],[0.0,0.1,0.9]],
            [[0.0,0.9,0.0],[0.0,0.0,0.3],[0.0,0.0,0.0]], #for example
       ]]).float()