Skip to content

Commit

Permalink
Skip mask tests when using numpy backend
Browse files Browse the repository at this point in the history
  • Loading branch information
jackd committed Nov 29, 2023
1 parent 479b872 commit 936dd13
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions keras/metrics/reduction_metrics_test.py
@@ -1,5 +1,7 @@
import numpy as np
import pytest

from keras import backend
from keras import ops
from keras import testing
from keras.metrics import reduction_metrics
Expand Down Expand Up @@ -123,6 +125,10 @@ def test_weighted(self):
result = mse_obj(y_true, y_pred, sample_weight=sample_weight)
self.assertAllClose(0.54285, result, atol=1e-5)

@pytest.mark.skipif(
backend.backend() == "numpy",
reason="Numpy backend does not support masking.",
)
def test_masked(self):
mse_obj = reduction_metrics.MeanMetricWrapper(
fn=mse, name="mse", dtype="float32"
Expand All @@ -144,6 +150,10 @@ def test_masked(self):
result = mse_obj(y_true, y_pred)
self.assertAllClose(expected, result, atol=1e-5)

@pytest.mark.skipif(
backend.backend() == "numpy",
reason="Numpy backend does not support masking.",
)
def test_masked_and_weighted(self):
mse_obj = reduction_metrics.MeanMetricWrapper(
fn=mse, name="mse", dtype="float32"
Expand Down

0 comments on commit 936dd13

Please sign in to comment.