Minor change to make test work with eq change
PiperOrigin-RevId: 261367832
This commit is contained in:
parent
c11b8e458b
commit
9274e93d4b
@ -75,6 +75,7 @@ py_library(
|
|||||||
"//tensorflow/python:math_ops",
|
"//tensorflow/python:math_ops",
|
||||||
"//tensorflow/python:platform",
|
"//tensorflow/python:platform",
|
||||||
"//tensorflow/python:resource_variable_ops",
|
"//tensorflow/python:resource_variable_ops",
|
||||||
|
"//tensorflow/python:tensor_util",
|
||||||
"//tensorflow/python/eager:context",
|
"//tensorflow/python/eager:context",
|
||||||
"//tensorflow/tools/docs:doc_controls",
|
"//tensorflow/tools/docs:doc_controls",
|
||||||
"@six_archive//:six",
|
"@six_archive//:six",
|
||||||
|
@ -30,6 +30,7 @@ from tensorflow.python.distribute import values as value_lib
|
|||||||
from tensorflow.python.eager import context
|
from tensorflow.python.eager import context
|
||||||
from tensorflow.python.framework import kernels
|
from tensorflow.python.framework import kernels
|
||||||
from tensorflow.python.framework import ops
|
from tensorflow.python.framework import ops
|
||||||
|
from tensorflow.python.framework import tensor_util
|
||||||
from tensorflow.python.ops import array_ops
|
from tensorflow.python.ops import array_ops
|
||||||
from tensorflow.python.ops import math_ops
|
from tensorflow.python.ops import math_ops
|
||||||
from tensorflow.python.ops import resource_variable_ops
|
from tensorflow.python.ops import resource_variable_ops
|
||||||
@ -84,7 +85,8 @@ def reduce_non_distributed_value(reduce_op, device_map, value, destinations):
|
|||||||
# If the same value is present on all replicas then the PerReplica value will
|
# If the same value is present on all replicas then the PerReplica value will
|
||||||
# be a single value. We also handle the case when `value` is a single value
|
# be a single value. We also handle the case when `value` is a single value
|
||||||
# and equal to 0.
|
# and equal to 0.
|
||||||
if value == 0:
|
# TODO:(b/138823479): handle the tensor value properly.
|
||||||
|
if not tensor_util.is_tensor(value) and value == 0:
|
||||||
return 0
|
return 0
|
||||||
# If there is only a single value and the reduce op is MEAN,
|
# If there is only a single value and the reduce op is MEAN,
|
||||||
# that value should be on all destinations.
|
# that value should be on all destinations.
|
||||||
|
Loading…
Reference in New Issue
Block a user