Add TF_MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING (#18469)
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -27,6 +27,7 @@ from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_te
|
||||
|
||||
|
||||
if is_tf_available():
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
|
||||
from transformers import TFSegformerForImageClassification, TFSegformerForSemanticSegmentation, TFSegformerModel
|
||||
@@ -336,6 +337,9 @@ class TFSegformerModelTest(TFModelTesterMixin, unittest.TestCase):
|
||||
def test_dataset_conversion(self):
|
||||
super().test_dataset_conversion()
|
||||
|
||||
def check_keras_fit_results(self, val_loss1, val_loss2, atol=2e-1, rtol=2e-1):
|
||||
self.assertTrue(np.allclose(val_loss1, val_loss2, atol=atol, rtol=rtol))
|
||||
|
||||
@unittest.skipIf(
|
||||
not is_tf_available() or len(tf.config.list_physical_devices("GPU")) == 0,
|
||||
reason="TF (<=2.8) does not support backprop for grouped convolutions on CPU.",
|
||||
|
||||
Reference in New Issue
Block a user