Yes. The targets/label size is BxHxW but I have extend 1 dims to BX1xHxW using unsqueeze_. The error is at scatter_ in which one_hot size of Bxnum_classxHxW but data copy has size of Bx(num_class+1)×HxW ( due to ignored class), thus we have to ignore the ignore class during copy. I have not find the solution yet.