Skip to content

Commit bf619d6

Browse files
committed
fix imports.
1 parent 8892316 commit bf619d6

File tree

12 files changed

+24
-20
lines changed

12 files changed

+24
-20
lines changed

stubs/tensorflow/tensorflow/data/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ from typing_extensions import Self
66

77
import numpy as np
88
import tensorflow as tf
9-
from tensorflow import TypeSpec, _ScalarTensorCompatible, _TensorCompatible
10-
from tensorflow._aliases import _ContainerGeneric
9+
from tensorflow import TypeSpec
10+
from tensorflow._aliases import _ContainerGeneric, _ScalarTensorCompatible, _TensorCompatible
1111
from tensorflow.data import experimental as experimental
1212
from tensorflow.data.experimental import AUTOTUNE as AUTOTUNE
1313
from tensorflow.dtypes import DType

stubs/tensorflow/tensorflow/data/experimental.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ from _typeshed import Incomplete
22
from collections.abc import Callable, Sequence
33
from typing import Final, TypeVar
44

5-
from tensorflow import Tensor, _TensorCompatible
5+
from tensorflow import Tensor
6+
from tensorflow._aliases import _TensorCompatible
67
from tensorflow.data import Dataset
78

89
AUTOTUNE: Final = -1

stubs/tensorflow/tensorflow/dtypes.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from builtins import bool as _bool
44
from typing import Any
55

66
import numpy as np
7-
from tensorflow import _DTypeLike
7+
from tensorflow._aliases import _DTypeLike
88

99
class _DTypeMeta(ABCMeta): ...
1010

stubs/tensorflow/tensorflow/feature_column/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from collections.abc import Callable, Iterable, Sequence
22

33
import tensorflow as tf
4-
from tensorflow import _ShapeLike
4+
from tensorflow._aliases import _ShapeLike
55
from tensorflow.python.feature_column import feature_column_v2 as fc, sequence_feature_column as seq_fc
66

77
def numeric_column(

stubs/tensorflow/tensorflow/io/__init__.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ from types import TracebackType
44
from typing import Literal, NamedTuple
55
from typing_extensions import Self, TypeAlias
66

7-
from tensorflow import _DTypeLike, _ShapeLike, _TensorCompatible
8-
from tensorflow._aliases import _TensorLike
7+
from tensorflow._aliases import _DTypeLike, _ShapeLike, _TensorCompatible, _TensorLike
98
from tensorflow.io import gfile as gfile
109

1110
_FeatureSpecs: TypeAlias = Mapping[str, FixedLenFeature | FixedLenSequenceFeature | VarLenFeature | RaggedFeature | SparseFeature]

stubs/tensorflow/tensorflow/keras/initializers.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ from collections.abc import Callable
33
from typing import Any, overload
44
from typing_extensions import Self, TypeAlias
55

6-
from tensorflow import Tensor, _DTypeLike, _ShapeLike, _TensorCompatible
6+
from tensorflow import Tensor
7+
from tensorflow._aliases import _DTypeLike, _ShapeLike, _TensorCompatible
78

89
class Initializer:
910
def __call__(self, shape: _ShapeLike, dtype: _DTypeLike | None = None) -> Tensor: ...

stubs/tensorflow/tensorflow/keras/layers.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ from typing import Any, Generic, TypeVar, overload
44
from typing_extensions import Self, TypeAlias
55

66
import tensorflow as tf
7-
from tensorflow import Tensor, Variable, VariableAggregation, VariableSynchronization, _TensorCompatible
8-
from tensorflow._aliases import _AnyArray
7+
from tensorflow import Tensor, Variable, VariableAggregation, VariableSynchronization
8+
from tensorflow._aliases import _AnyArray, _DTypeLike, _TensorCompatible
99
from tensorflow.keras.activations import _Activation
1010
from tensorflow.keras.constraints import Constraint
1111
from tensorflow.keras.initializers import _Initializer
@@ -23,7 +23,7 @@ class InputSpec:
2323
axes: dict[int, int | None] | None
2424
def __init__(
2525
self,
26-
dtype: tf._DTypeLike | None = None,
26+
dtype: _DTypeLike | None = None,
2727
shape: Iterable[int | None] | None = None,
2828
ndim: int | None = None,
2929
max_ndim: int | None = None,
@@ -49,7 +49,7 @@ class Layer(tf.Module, Generic[_InputT, _OutputT]):
4949
@trainable.setter
5050
def trainable(self, value: bool) -> None: ...
5151
def __init__(
52-
self, trainable: bool = True, name: str | None = None, dtype: tf._DTypeLike | None = None, dynamic: bool = False
52+
self, trainable: bool = True, name: str | None = None, dtype: _DTypeLike | None = None, dynamic: bool = False
5353
) -> None: ...
5454

5555
# *args/**kwargs are allowed, but have obscure footguns and tensorflow documentation discourages their usage.
@@ -69,7 +69,7 @@ class Layer(tf.Module, Generic[_InputT, _OutputT]):
6969
self,
7070
name: str | None = None,
7171
shape: Iterable[int | None] | None = None,
72-
dtype: tf._DTypeLike | None = None,
72+
dtype: _DTypeLike | None = None,
7373
initializer: _Initializer | None = None,
7474
regularizer: _Regularizer = None,
7575
trainable: bool | None = None,
@@ -106,7 +106,7 @@ class Layer(tf.Module, Generic[_InputT, _OutputT]):
106106
# all layer constructors.
107107

108108
# TODO: Replace last Any after adding tf.keras.mixed_precision.Policy.
109-
_LayerDtype: TypeAlias = tf._DTypeLike | dict[str, Any] | Any
109+
_LayerDtype: TypeAlias = _DTypeLike | dict[str, Any] | Any
110110

111111
_Constraint: TypeAlias = str | dict[str, Any] | Constraint | None
112112

stubs/tensorflow/tensorflow/keras/losses.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ from collections.abc import Callable
44
from typing import Any, Final, Literal, TypeVar, overload
55
from typing_extensions import Self, TypeAlias, TypeGuard
66

7-
from tensorflow import Tensor, _TensorCompatible
8-
from tensorflow._aliases import _KerasSerializable
7+
from tensorflow import Tensor
8+
from tensorflow._aliases import _KerasSerializable, _TensorCompatible
99
from tensorflow.keras.metrics import (
1010
binary_crossentropy as binary_crossentropy,
1111
categorical_crossentropy as categorical_crossentropy,

stubs/tensorflow/tensorflow/keras/metrics.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from tensorflow import Tensor, _TensorCompatible
1+
from tensorflow import Tensor
2+
from tensorflow._aliases import _TensorCompatible
23

34
def binary_crossentropy(
45
y_true: _TensorCompatible, y_pred: _TensorCompatible, from_logits: bool = False, label_smoothing: float = 0.0, axis: int = -1

stubs/tensorflow/tensorflow/math.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ from collections.abc import Iterable
33
from typing import TypeVar, overload
44
from typing_extensions import TypeAlias
55

6-
from tensorflow import IndexedSlices, RaggedTensor, Tensor, _DTypeLike, _ShapeLike, _TensorCompatible
6+
from tensorflow import IndexedSlices, RaggedTensor, Tensor
7+
from tensorflow._aliases import _DTypeLike, _ShapeLike, _TensorCompatible
78
from tensorflow.sparse import SparseTensor
89

910
_TensorCompatibleT = TypeVar("_TensorCompatibleT", bound=_TensorCompatible)

0 commit comments

Comments
 (0)