Hi KFrank
thanks for your quick response. if I understand correctly, I create y-label with 3 classes and also the output of my network.
the batch size here is 1 and H = 4 and W = 3 in one channel, like the code below:
y_label = [[[1, 0, 2],
            [1, 1, 0],
            [2, 0, 0],
            [1, 0, 0]]]
y_label = torch.FloatTensor(y_label)
# print(y_label.shape) >> torch.Size([1, 4, 3])

y_target = [[[0.950, 0.210, 0.890],
             [0.875, 0.254, 0.248],
             [0.875, 0.012, 0.148],
             [0.542, 0.143, 0.002]]]
y_target = torch.FloatTensor(y_target)
# print(y_target.shape) >> torch.Size([1, 4, 3])

loss_func = nn.CrossEntropyLoss()
loss = loss_func(y_label, y_target)

but I get an error
ValueError: Expected target size (1, 3), got torch.Size([1, 4, 3])