tf.numpy avoid using typing module given Kokoro breakage.
PiperOrigin-RevId: 317396321 Change-Id: Ifa05dcbbdd8998708e52ba52cdb03e33e4952f21
This commit is contained in:
parent
1823f87735
commit
866eb4828a
@ -21,7 +21,6 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import math
|
import math
|
||||||
import numbers
|
import numbers
|
||||||
from typing import Sequence
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@ -1684,10 +1683,10 @@ def _slice_helper(tensor, slice_spec):
|
|||||||
def _as_spec_tuple(slice_spec):
|
def _as_spec_tuple(slice_spec):
|
||||||
"""Convert slice_spec to tuple."""
|
"""Convert slice_spec to tuple."""
|
||||||
if isinstance(slice_spec,
|
if isinstance(slice_spec,
|
||||||
Sequence) and not isinstance(slice_spec, np.ndarray):
|
(list, tuple)) and not isinstance(slice_spec, np.ndarray):
|
||||||
is_index = True
|
is_index = True
|
||||||
for s in slice_spec:
|
for s in slice_spec:
|
||||||
if s is None or s is Ellipsis or isinstance(s, (Sequence, slice)):
|
if s is None or s is Ellipsis or isinstance(s, (list, tuple, slice)):
|
||||||
is_index = False
|
is_index = False
|
||||||
break
|
break
|
||||||
elif isinstance(s, (np_arrays.ndarray, np.ndarray)) and s.ndim != 0:
|
elif isinstance(s, (np_arrays.ndarray, np.ndarray)) and s.ndim != 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user