correct pylint formattings - 2
This commit is contained in:
parent
d3e2a16524
commit
9886910012
tensorflow/python/distribute
@ -2002,10 +2002,11 @@ def _get_dataset_attributes(dataset):
|
|||||||
|
|
||||||
def _should_use_multi_device_iterator(options):
|
def _should_use_multi_device_iterator(options):
|
||||||
"""Determine whether to use multi_device_iterator_ops.OwnedMultiDeviceIterator"""
|
"""Determine whether to use multi_device_iterator_ops.OwnedMultiDeviceIterator"""
|
||||||
if (options is None
|
if (options is None or
|
||||||
or options.experimental_replication_mode == InputReplicationMode.PER_WORKER
|
options.experimental_replication_mode == InputReplicationMode.PER_WORKER
|
||||||
or (options.experimental_replication_mode == InputReplicationMode.PER_REPLICA
|
or
|
||||||
and options.experimental_prefetch_to_device)):
|
(options.experimental_replication_mode == InputReplicationMode.PER_REPLICA
|
||||||
|
and options.experimental_prefetch_to_device)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -462,15 +462,16 @@ class InputTypeSpecTest(test.TestCase, parameterized.TestCase):
|
|||||||
enable_get_next_as_optional=[True, False],
|
enable_get_next_as_optional=[True, False],
|
||||||
experimental_place_dataset_on_device=[True, False],
|
experimental_place_dataset_on_device=[True, False],
|
||||||
experimental_prefetch_to_device=[True, False],))
|
experimental_prefetch_to_device=[True, False],))
|
||||||
def testFromFunctionInputSignatureForPerReplicaValuesWithOptions(self, distribution,
|
def testFromFunctionInputSignatureForPerReplicaValuesWithOptions(
|
||||||
enable_get_next_as_optional,
|
self, distribution, enable_get_next_as_optional,
|
||||||
experimental_place_dataset_on_device,
|
experimental_place_dataset_on_device,
|
||||||
experimental_prefetch_to_device):
|
experimental_prefetch_to_device):
|
||||||
|
|
||||||
if experimental_place_dataset_on_device and experimental_prefetch_to_device:
|
if experimental_place_dataset_on_device and experimental_prefetch_to_device:
|
||||||
self.skipTest("Setting experimental_place_dataset_on_device and "
|
self.skipTest("Setting experimental_place_dataset_on_device and "
|
||||||
"experimental_prefetch_to_device to `True` is not allowed "
|
"experimental_prefetch_to_device to `True` is not "
|
||||||
"when using distribute_lib.InputReplicationMode.PER_REPLICA.")
|
"allowed when using "
|
||||||
|
"distribute_lib.InputReplicationMode.PER_REPLICA.")
|
||||||
|
|
||||||
fname1 = os.path.join(self.get_temp_dir(), "1.txt")
|
fname1 = os.path.join(self.get_temp_dir(), "1.txt")
|
||||||
_create_text_file(fname1, 5)
|
_create_text_file(fname1, 5)
|
||||||
@ -486,13 +487,16 @@ class InputTypeSpecTest(test.TestCase, parameterized.TestCase):
|
|||||||
input_context.get_per_replica_batch_size(4))
|
input_context.get_per_replica_batch_size(4))
|
||||||
|
|
||||||
options = distribute_lib.InputOptions(
|
options = distribute_lib.InputOptions(
|
||||||
experimental_place_dataset_on_device=experimental_place_dataset_on_device,
|
experimental_place_dataset_on_device=experimental_place_dataset_on_device,
|
||||||
experimental_prefetch_to_device=experimental_prefetch_to_device,
|
experimental_prefetch_to_device=experimental_prefetch_to_device,
|
||||||
experimental_replication_mode=distribute_lib.InputReplicationMode.PER_REPLICA)
|
experimental_replication_mode=(
|
||||||
|
distribute_lib.InputReplicationMode.PER_REPLICA
|
||||||
|
))
|
||||||
|
|
||||||
distribution.extended.experimental_enable_get_next_as_optional = (
|
distribution.extended.experimental_enable_get_next_as_optional = (
|
||||||
enable_get_next_as_optional)
|
enable_get_next_as_optional)
|
||||||
ds = distribution.experimental_distribute_datasets_from_function(dataset_fn, options)
|
ds = distribution.experimental_distribute_datasets_from_function(dataset_fn,
|
||||||
|
options)
|
||||||
|
|
||||||
iterator = iter(ds)
|
iterator = iter(ds)
|
||||||
_check_type_spec_structure(iterator)
|
_check_type_spec_structure(iterator)
|
||||||
|
Loading…
Reference in New Issue
Block a user