@@ -6,7 +6,7 @@ from contextlib import contextmanager
6
6
from enum import Enum
7
7
from types import TracebackType
8
8
from typing import Any , Generic , NoReturn , TypeVar , overload
9
- from typing_extensions import ParamSpec , Self , TypeAlias
9
+ from typing_extensions import ParamSpec , Self
10
10
11
11
import numpy
12
12
from google .protobuf .message import Message
@@ -19,7 +19,17 @@ from tensorflow import (
19
19
keras as keras ,
20
20
math as math ,
21
21
)
22
- from tensorflow ._aliases import _ContainerGradients , _ContainerTensors , _ContainerTensorsLike , _Gradients , _TensorLike
22
+ from tensorflow ._aliases import (
23
+ _ContainerGradients ,
24
+ _ContainerTensors ,
25
+ _ContainerTensorsLike ,
26
+ _DTypeLike ,
27
+ _Gradients ,
28
+ _ShapeLike ,
29
+ _Slice ,
30
+ _TensorCompatible ,
31
+ _TensorLike ,
32
+ )
23
33
from tensorflow .core .protobuf import struct_pb2
24
34
25
35
# Explicit import of DType is covered by the wildcard, but
@@ -73,15 +83,6 @@ from tensorflow.sparse import SparseTensor as SparseTensor
73
83
# we will skip making Tensor generic. Also good type hints for shapes will
74
84
# run quickly into many places where type system is not strong enough today.
75
85
# So shape typing is probably not worth doing anytime soon.
76
- _Slice : TypeAlias = int | slice | None
77
-
78
- _FloatDataSequence : TypeAlias = Sequence [float ] | Sequence [_FloatDataSequence ]
79
- _StrDataSequence : TypeAlias = Sequence [str ] | Sequence [_StrDataSequence ]
80
- _ScalarTensorCompatible : TypeAlias = Tensor | str | float | numpy .ndarray [Any , Any ] | numpy .number [Any ]
81
- _TensorCompatible : TypeAlias = _ScalarTensorCompatible | Sequence [_TensorCompatible ]
82
- _ShapeLike : TypeAlias = TensorShape | Iterable [_ScalarTensorCompatible | None ] | int | Tensor
83
- _DTypeLike : TypeAlias = DType | str | numpy .dtype [Any ]
84
-
85
86
class Tensor :
86
87
def __init__ (self , op : Operation , value_index : int , dtype : DType ) -> None : ...
87
88
def consumers (self ) -> list [Incomplete ]: ...
0 commit comments