Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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 requirements/typing.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mypy ==1.17.1
mypy ==1.18.1
torch ==2.8.0

types-PyYAML
Expand Down
6 changes: 3 additions & 3 deletions src/torchmetrics/functional/image/ssim.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def _ssim_update(
raise ValueError(f"Expected `sigma` to have positive number. Got {sigma}.")

if data_range is None:
data_range = max(preds.max() - preds.min(), target.max() - target.min()) # type: ignore[call-overload]
data_range = max(preds.max() - preds.min(), target.max() - target.min()).item()
elif isinstance(data_range, tuple):
preds = torch.clamp(preds, min=data_range[0], max=data_range[1])
target = torch.clamp(target, min=data_range[0], max=data_range[1])
data_range = data_range[1] - data_range[0]

c1 = pow(k1 * data_range, 2) # type: ignore[operator]
c2 = pow(k2 * data_range, 2) # type: ignore[operator]
c1 = pow(k1 * data_range, 2)
c2 = pow(k2 * data_range, 2)
device = preds.device

channel = preds.size(1)
Expand Down
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/text/squad.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _metric_max_over_ground_truths(
metric_fn: Callable[[str, str], Tensor], prediction: str, ground_truths: list[str]
) -> Tensor:
"""Calculate maximum score for a predicted answer with all reference answers."""
return max(metric_fn(prediction, truth) for truth in ground_truths) # type: ignore[type-var]
return max(metric_fn(prediction, truth) for truth in ground_truths)


def _squad_input_check(
Expand Down
Loading