From d807bfcb6460b8cf4d48137c2c16be43826d816d Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 27 May 2020 15:00:03 -0700 Subject: [PATCH] Stop explicitly passing a `name` arg to `slice` from `slice_helper`. (while leaving in the name_scopes). This makes the slice operator more dispatch-friendly, because `slice` dispatches while `slice_helper` doesn't. This means the `dispatched` operation no longer has a name locked in and is less likely to run into issues where multiple ops are created w/ the same name. PiperOrigin-RevId: 313470510 Change-Id: Id26a5713258124d8a02ad4938f444f3f8103e528 --- tensorflow/python/ops/array_ops.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tensorflow/python/ops/array_ops.py b/tensorflow/python/ops/array_ops.py index 118c2cfca55..a641633b1f5 100644 --- a/tensorflow/python/ops/array_ops.py +++ b/tensorflow/python/ops/array_ops.py @@ -983,7 +983,7 @@ def _slice_helper(tensor, slice_spec, var=None): with ops.name_scope( None, "strided_slice", [tensor] + begin + end + strides, - skip_on_eager=False): + skip_on_eager=False) as name: if begin: packed_begin, packed_end, packed_strides = (stack(begin), stack(end), stack(strides)) @@ -1009,7 +1009,8 @@ def _slice_helper(tensor, slice_spec, var=None): shrink_axis_mask=shrink_axis_mask, new_axis_mask=new_axis_mask, ellipsis_mask=ellipsis_mask, - var=var) + var=var, + name=name) # pylint: disable=undefined-variable,protected-access,redefined-outer-name @@ -1193,7 +1194,7 @@ def strided_slice(input_, if var is None: raise ValueError("Sliced assignment is only supported for variables") else: - if name is None and parent_name: + if name is None: name = parent_name + "_assign" return var._strided_slice_assign(