Skip to content

Commit e56a919

Browse files
committed
a new commit
Signed-off-by: AymanL <40838419+AymanL@users.noreply.github.com>
1 parent be31e64 commit e56a919

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

monai/metrics/frd.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,9 @@ def get_frd_score(y_pred: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
6161
6262
Returns:
6363
Scalar tensor containing the Fréchet Radiomics Distance.
64+
65+
Raises:
66+
ValueError: When either tensor has more than 2 dimensions. Inputs must have
67+
shape (number of samples, number of features).
6468
"""
6569
return get_fid_score(y_pred, y)

tests/metrics/test_compute_frd_metric.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ def test_frd_matches_fid_for_same_features(self):
3838
fid_score = FIDMetric()(y_pred, y)
3939
np.testing.assert_allclose(frd_score.cpu().numpy(), fid_score.cpu().numpy(), atol=1e-6)
4040

41-
def test_input_dimensions(self):
41+
def test_rejects_high_dimensional_input(self):
42+
"""FrechetRadiomicsDistance raises ValueError when inputs have ndimension() > 2."""
43+
high_dim = torch.ones([3, 3, 144, 144])
4244
with self.assertRaises(ValueError):
43-
FrechetRadiomicsDistance()(torch.ones([3, 3, 144, 144]), torch.ones([3, 3, 145, 145]))
45+
FrechetRadiomicsDistance()(high_dim, high_dim)
4446

4547

4648
if __name__ == "__main__":

0 commit comments

Comments
 (0)