Skip to content

Commit

Permalink
hotfix on classification metrics (#2878)
Browse files Browse the repository at this point in the history
* Faster classfication stats

* Faster accuracy metric

* minor change on cls metric

* Add out-of-bound class clamping

* Add more tests and minor fixes

* Resolve code style warning

* Update for #2781

* hotfix

* Update pytorch_lightning/metrics/functional/classification.py

Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>

* Update about conversation

* Add docstring on stat_scores_multiple_classes

* Fixing #2862

Co-authored-by: Younghun Roh <yhunroh@mindslab.ai>
Co-authored-by: Jirka Borovec <Borda@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 8, 2020
1 parent a6e7aa7 commit d9d7e91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pytorch_lightning/metrics/functional/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ def stat_scores_multiple_classes(
num_classes = get_num_classes(pred=pred, target=target, num_classes=num_classes)

if pred.dtype != torch.bool:
pred.clamp_max_(max=num_classes)
pred = pred.clamp_max(max=num_classes)
if target.dtype != torch.bool:
target.clamp_max_(max=num_classes)
target = target.clamp_max(max=num_classes)

possible_reductions = ('none', 'sum', 'elementwise_mean')
if reduction not in possible_reductions:
Expand Down

0 comments on commit d9d7e91

Please sign in to comment.