Cross entropy for diff shaped input and target

My input is of shape torch.Size([16, 4, 224, 224]) and target is of shape torch.Size([16, 224, 224]), does cross entropy function in pytorch take them as intended inputs?

Yes, as described in the docs.

1 Like