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
This commit is contained in:
parent
43862c55a3
commit
d807bfcb64
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user