You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I train SMP SegFormer with multilabel FocalLoss this RuntimeError appears:
58 if self.mode in {BINARY_MODE, MULTILABEL_MODE}:
59 y_true = y_true.view(-1)
---> 60 y_pred = y_pred.view(-1)
62 if self.ignore_index is not None:
63 # Filter predictions with ignore label from loss computation
64 not_ignored = y_true != self.ignore_index
RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.
It does not appear in multiclass mode.
I checked my y_pred and y_true shapes and they are
When I train SMP SegFormer with multilabel FocalLoss this RuntimeError appears:
It does not appear in multiclass mode.
I checked my y_pred and y_true shapes and they are
After changing
to
the error disappeared.
Maybe it is related to #998 where
.contiguous()
is removed from SegFormer decoder.As
mode
logic is usually the same in every loss, this error may appear in other losses too, and in binary mode too.Maybe replacing
view
withreshape
can be a good fix? Or it will slow computations down likecontiguous()
did?The text was updated successfully, but these errors were encountered: