Flattens predictions in the batch (binary case) Remove labels equal to 'ignore'
(scores, labels, ignore=None)
| 558 | |
| 559 | |
| 560 | def _flatten_binary_scores(scores, labels, ignore=None): |
| 561 | """Flattens predictions in the batch (binary case) |
| 562 | Remove labels equal to 'ignore' |
| 563 | """ |
| 564 | scores = scores.view(-1) |
| 565 | labels = labels.view(-1) |
| 566 | if ignore is None: |
| 567 | return scores, labels |
| 568 | valid = labels != ignore |
| 569 | vscores = scores[valid] |
| 570 | vlabels = labels[valid] |
| 571 | return vscores, vlabels |
| 572 | |
| 573 | |
| 574 | def _lovasz_softmax( |