-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Describe the bug
File "/home//anaconda3/envs/mmseg020/lib/python3.8/site-packages/mmseg/models/losses/cross_entropy_loss.py", line 86, in binary_cross_entropy
label, weight = _expand_onehot_labels(label, weight, pred.shape,
File "/home//anaconda3/envs/mmseg020/lib/python3.8/site-packages/mmseg/models/losses/cross_entropy_loss.py", line 53, in _expand_onehot_labels
bin_label_weights *= valid_mask
RuntimeError: unsupported operation: more than one element of the written-to tensor refers to a single memory location. Please clone() the tensor before performing the operation.
Bug fix
mmseg/models/losses/cross_entropy_loss.py, line 52, in _expand_onehot_labels
bin_label_weights = label_weights.unsqueeze(1).expand(target_shape).clone()
bin_label_weights *= valid_mask