Skip to content

Commit

Permalink
use common.DEBUG_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
kvignesh1420 committed Sep 11, 2021
1 parent ca41773 commit 8b24120
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tensorflow/python/data/ops/dataset_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from tensorflow.python.compat import compat
from tensorflow.python.data.ops import iterator_ops
from tensorflow.python.data.ops import options as options_lib
from tensorflow.python.data.ops.common import DEBUG_MODE
from tensorflow.python.data.ops import common
from tensorflow.python.data.ops.common import StructuredFunctionWrapper
from tensorflow.python.data.ops.common import _should_unpack
from tensorflow.python.data.util import nest
Expand Down Expand Up @@ -440,7 +440,7 @@ def options(self):
return self._options_attr

def _apply_debug_options(self):
if DEBUG_MODE:
if common.DEBUG_MODE:
# Disable autotuning and static optimizations that could introduce
# parallelism or asynchrony.
options = options_lib.Options()
Expand Down Expand Up @@ -1255,7 +1255,7 @@ def prefetch(self, buffer_size, name=None):
Returns:
Dataset: A `Dataset`.
"""
if DEBUG_MODE:
if common.DEBUG_MODE:
return self
return PrefetchDataset(self, buffer_size, name=name)

Expand Down Expand Up @@ -1677,8 +1677,8 @@ def batch(self,
Returns:
Dataset: A `Dataset`.
"""
if num_parallel_calls is None or DEBUG_MODE:
if deterministic is not None and not DEBUG_MODE:
if num_parallel_calls is None or common.DEBUG_MODE:
if deterministic is not None and not common.DEBUG_MODE:
warnings.warn("The `deterministic` argument has no effect unless the "
"`num_parallel_calls` argument is specified.")
return BatchDataset(self, batch_size, drop_remainder, name=name)
Expand Down Expand Up @@ -1980,8 +1980,8 @@ def map(self,
Returns:
Dataset: A `Dataset`.
"""
if num_parallel_calls is None or DEBUG_MODE:
if deterministic is not None and not DEBUG_MODE:
if num_parallel_calls is None or common.DEBUG_MODE:
if deterministic is not None and not common.DEBUG_MODE:
warnings.warn("The `deterministic` argument has no effect unless the "
"`num_parallel_calls` argument is specified.")
return MapDataset(self, map_func, preserve_cardinality=True, name=name)
Expand Down Expand Up @@ -2144,8 +2144,8 @@ def interleave(
if cycle_length is None:
cycle_length = AUTOTUNE

if num_parallel_calls is None or DEBUG_MODE:
if deterministic is not None and not DEBUG_MODE:
if num_parallel_calls is None or common.DEBUG_MODE:
if deterministic is not None and not common.DEBUG_MODE:
warnings.warn("The `deterministic` argument has no effect unless the "
"`num_parallel_calls` argument is specified.")
return InterleaveDataset(
Expand Down Expand Up @@ -3795,7 +3795,7 @@ def map(self,
num_parallel_calls=None,
deterministic=None,
name=None):
if num_parallel_calls is None or DEBUG_MODE:
if num_parallel_calls is None or common.DEBUG_MODE:
return DatasetV1Adapter(
MapDataset(self, map_func, preserve_cardinality=False))
else:
Expand Down Expand Up @@ -6393,5 +6393,4 @@ def func(x):


def toggle_debug_mode(debug_mode):
global DEBUG_MODE
DEBUG_MODE = debug_mode
common.DEBUG_MODE = debug_mode

0 comments on commit 8b24120

Please sign in to comment.