From 6a2eb23876178fc461aaf0fe3e452d4c122579f5 Mon Sep 17 00:00:00 2001 From: Janusz Lisiecki <39967756+JanuszL@users.noreply.github.com> Date: Wed, 15 Jun 2022 10:34:21 +0200 Subject: [PATCH] Fix test_dali_tf_dataset_mnist_eager.py and test_dali_tf_dataset_mnist_graph.py tests (#3987) - adds a proper import for skip_for_incompatible_tf in test_dali_tf_dataset_mnist_eager.py test - adds missing import of with_setup to test_dali_tf_dataset_mnist_graph.py Signed-off-by: Janusz Lisiecki --- dali/test/python/test_dali_tf_dataset_mnist_eager.py | 9 +++++---- dali/test/python/test_dali_tf_dataset_mnist_graph.py | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/dali/test/python/test_dali_tf_dataset_mnist_eager.py b/dali/test/python/test_dali_tf_dataset_mnist_eager.py index abdb9c57269..8424bf8a5c8 100644 --- a/dali/test/python/test_dali_tf_dataset_mnist_eager.py +++ b/dali/test/python/test_dali_tf_dataset_mnist_eager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ from nose.tools import with_setup import test_dali_tf_dataset_mnist as mnist +from test_utils_tensorflow import skip_for_incompatible_tf from nose_utils import raises tf.compat.v1.enable_eager_execution() @@ -33,7 +34,7 @@ def test_keras_single_cpu(): mnist.run_keras_single_device('cpu', 0) -@with_setup(mnist.skip_for_incompatible_tf) +@with_setup(skip_for_incompatible_tf) @raises(Exception, "TF device and DALI device mismatch") def test_keras_wrong_placement_gpu(): with tf.device('cpu:0'): @@ -46,7 +47,7 @@ def test_keras_wrong_placement_gpu(): steps_per_epoch=mnist.ITERATIONS) -@with_setup(mnist.skip_for_incompatible_tf) +@with_setup(skip_for_incompatible_tf) @raises(Exception, "TF device and DALI device mismatch") def test_keras_wrong_placement_cpu(): with tf.device('gpu:0'): @@ -59,7 +60,7 @@ def test_keras_wrong_placement_cpu(): steps_per_epoch=mnist.ITERATIONS) -@with_setup(mnist.skip_for_incompatible_tf) +@with_setup(skip_for_incompatible_tf) def test_keras_multi_gpu_mirrored_strategy(): strategy = tf.distribute.MirroredStrategy(devices=mnist.available_gpus()) diff --git a/dali/test/python/test_dali_tf_dataset_mnist_graph.py b/dali/test/python/test_dali_tf_dataset_mnist_graph.py index d10f1afaaa8..5f175889d38 100644 --- a/dali/test/python/test_dali_tf_dataset_mnist_graph.py +++ b/dali/test/python/test_dali_tf_dataset_mnist_graph.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2020-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,6 +14,7 @@ from test_dali_tf_dataset_mnist import * from nose_utils import raises +from nose import with_setup tf.compat.v1.disable_eager_execution()