Skip to content

Commit

Permalink
added missing space in error message (#1726)
Browse files Browse the repository at this point in the history
* added missing space in error message
* spaces in next line
  • Loading branch information
maxi-w authored Apr 26, 2023
1 parent 98bcf1a commit b3c8ebb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/torchmetrics/functional/classification/stat_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,17 +302,17 @@ def _multiclass_stat_scores_tensor_validation(
check = num_unique_values > num_classes if ignore_index is None else num_unique_values > num_classes + 1
if check:
raise RuntimeError(
"Detected more unique values in `target` than `num_classes`. Expected only "
f"{num_classes if ignore_index is None else num_classes + 1} but found"
f"{num_unique_values} in `target`."
"Detected more unique values in `target` than `num_classes`. Expected only"
f" {num_classes if ignore_index is None else num_classes + 1} but found"
f" {num_unique_values} in `target`."
)

if not preds.is_floating_point():
unique_values = torch.unique(preds)
if len(unique_values) > num_classes:
raise RuntimeError(
"Detected more unique values in `preds` than `num_classes`. Expected only "
f"{num_classes} but found {len(unique_values)} in `preds`."
"Detected more unique values in `preds` than `num_classes`. Expected only"
f" {num_classes} but found {len(unique_values)} in `preds`."
)


Expand Down

0 comments on commit b3c8ebb

Please sign in to comment.