mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Use PEP 570 syntax in third party stubs (#11554)
This commit is contained in:
@@ -146,13 +146,14 @@ class Dataset(ABC, Generic[_T1]):
|
||||
) -> Dataset[tf.Tensor]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def range(__stop: ScalarTensorCompatible, output_type: DType = ..., name: str | None = None) -> Dataset[tf.Tensor]: ...
|
||||
def range(stop: ScalarTensorCompatible, /, output_type: DType = ..., name: str | None = None) -> Dataset[tf.Tensor]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def range(
|
||||
__start: ScalarTensorCompatible,
|
||||
__stop: ScalarTensorCompatible,
|
||||
__step: ScalarTensorCompatible = 1,
|
||||
start: ScalarTensorCompatible,
|
||||
stop: ScalarTensorCompatible,
|
||||
step: ScalarTensorCompatible = 1,
|
||||
/,
|
||||
output_type: DType = ...,
|
||||
name: str | None = None,
|
||||
) -> Dataset[tf.Tensor]: ...
|
||||
|
||||
@@ -6,7 +6,7 @@ from tensorflow import Tensor
|
||||
|
||||
class Constraint:
|
||||
def get_config(self) -> dict[str, Any]: ...
|
||||
def __call__(self, __w: Tensor) -> Tensor: ...
|
||||
def __call__(self, w: Tensor, /) -> Tensor: ...
|
||||
|
||||
@overload
|
||||
def get(identifier: None) -> None: ...
|
||||
|
||||
@@ -56,15 +56,15 @@ class Layer(tf.Module, Generic[_InputT, _OutputT]):
|
||||
# First argument will automatically be cast to layer's compute dtype, but any other tensor arguments will not be.
|
||||
# Also various tensorflow tools/apis can misbehave if they encounter a layer with *args/**kwargs.
|
||||
def __call__(self, inputs: _InputT, *, training: bool = False, mask: TensorCompatible | None = None) -> _OutputT: ...
|
||||
def call(self, __inputs: _InputT) -> _OutputT: ...
|
||||
def call(self, inputs: _InputT, /) -> _OutputT: ...
|
||||
|
||||
# input_shape's real type depends on _InputT, but we can't express that without HKT.
|
||||
# For example _InputT tf.Tensor -> tf.TensorShape, _InputT dict[str, tf.Tensor] -> dict[str, tf.TensorShape].
|
||||
def build(self, __input_shape: Any) -> None: ...
|
||||
def build(self, input_shape: Any, /) -> None: ...
|
||||
@overload
|
||||
def compute_output_shape(self: Layer[tf.Tensor, tf.Tensor], __input_shape: tf.TensorShape) -> tf.TensorShape: ...
|
||||
def compute_output_shape(self: Layer[tf.Tensor, tf.Tensor], input_shape: tf.TensorShape, /) -> tf.TensorShape: ...
|
||||
@overload
|
||||
def compute_output_shape(self, __input_shape: Any) -> Any: ...
|
||||
def compute_output_shape(self, input_shape: Any, /) -> Any: ...
|
||||
def add_weight(
|
||||
self,
|
||||
name: str | None = None,
|
||||
|
||||
@@ -8,7 +8,7 @@ class Regularizer:
|
||||
def get_config(self) -> dict[str, Any]: ...
|
||||
@classmethod
|
||||
def from_config(cls, config: dict[str, Any]) -> Self: ...
|
||||
def __call__(self, __x: Tensor) -> Tensor: ...
|
||||
def __call__(self, x: Tensor, /) -> Tensor: ...
|
||||
|
||||
_Regularizer: TypeAlias = str | dict[str, Any] | Regularizer | None # noqa: Y047
|
||||
|
||||
|
||||
Reference in New Issue
Block a user