Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/torchmetrics/audio/pesq.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(
if mode not in ("wb", "nb"):
raise ValueError(f"Expected argument `mode` to either be 'wb' or 'nb' but got {mode}")
self.mode = mode
if not isinstance(n_processes, int) and n_processes <= 0:
if not isinstance(n_processes, int) or n_processes <= 0:
raise ValueError(f"Expected argument `n_processes` to be an int larger than 0 but got {n_processes}")
self.n_processes = n_processes

Expand Down
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/classification/auroc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _binary_auroc_arg_validation(
ignore_index: Optional[int] = None,
) -> None:
_binary_precision_recall_curve_arg_validation(thresholds, ignore_index)
if max_fpr is not None and not isinstance(max_fpr, float) and 0 < max_fpr <= 1:
if max_fpr is not None and (not isinstance(max_fpr, float) or not (0 < max_fpr <= 1)):
raise ValueError(f"Arguments `max_fpr` should be a float in range (0, 1], but got: {max_fpr}")


Expand Down
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/classification/logauc.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

def _validate_fpr_range(fpr_range: Tuple[float, float]) -> None:
"""Validate the `fpr_range` argument for the logauc metric."""
if not isinstance(fpr_range, tuple) and not len(fpr_range) == 2:
if not isinstance(fpr_range, tuple) or len(fpr_range) != 2:
raise ValueError(f"The `fpr_range` should be a tuple of two floats, but got {type(fpr_range)}.")
if not (0 <= fpr_range[0] < fpr_range[1] <= 1):
raise ValueError(f"The `fpr_range` should be a tuple of two floats in the range [0, 1], but got {fpr_range}.")
Expand Down
2 changes: 1 addition & 1 deletion src/torchmetrics/retrieval/auroc.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(
if top_k is not None and not (isinstance(top_k, int) and top_k > 0):
raise ValueError("`top_k` has to be a positive integer or None")
self.top_k = top_k
if max_fpr is not None and not isinstance(max_fpr, float) and 0 < max_fpr <= 1:
if max_fpr is not None and (not isinstance(max_fpr, float) or not (0 < max_fpr <= 1)):
raise ValueError(f"Arguments `max_fpr` should be a float in range (0, 1], but got: {max_fpr}")
self.max_fpr = max_fpr

Expand Down