8000 Initial tensorflow stubs by hmc-cs-mdrissi · Pull Request #8974 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Initial tensorflow stubs #8974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add default values and fix pyright errors.
  • Loading branch information
Mehdi Drissi committed Jan 11, 2023
commit 304756db9be97bc86b2911b63c34696d226eee4d
16 changes: 9 additions & 7 deletions stubs/tensorflow/tensorflow/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ class Tensor:

class RaggedTensor:
def bounding_shape(
self, axis: _TensorCompatible | None = ..., name: str | None = ..., out_type: _DTypeLike | None = ...
self, axis: _TensorCompatible | None = None, name: str | None = None, out_type: _DTypeLike | None = None
) -> Tensor: ...
@classmethod
def from_sparse(cls, st_input: SparseTensor, name: str | None = ..., row_splits_dtype: _DTypeLike = ...) -> RaggedTensor: ...
def to_sparse(self, name: str | None = ...) -> SparseTensor: ...
def from_sparse(
cls, st_input: SparseTensor, name: str | None = None, row_splits_dtype: _DTypeLike = int64
) -> RaggedTensor: ...
def to_sparse(self, name: str | None = None) -> SparseTensor: ...
def to_tensor(
self, default_value: float | str | None = ..., name: str | None = ..., shape: _ShapeLike | None = ...
self, default_value: float | str | None = None, name: str | None = None, shape: _ShapeLike | None = None
) -> Tensor: ...
def __add__(self, other: RaggedTensor | float) -> RaggedTensor: ...
def __radd__(self, other: RaggedTensor | float) -> RaggedTensor: ...
Expand Down Expand Up @@ -112,7 +114,7 @@ class Operation:
def __getattr__(self, name: str) -> Incomplete: ...

class TensorShape:
def __init__(self, dims: _ShapeLike): ...
def __init__(self, dims: _ShapeLike) -> None: ...
@property
def rank(self) -> int: ...
def as_list(self) -> list[int | None]: ...
Expand All @@ -131,8 +133,8 @@ class TensorShape:
def __getattr__(self, name: str) -> Incomplete: ...

class Graph:
def add_to_collection(self, name: str, value: object): ...
def add_to_collections(self, names: Iterable[str] | str, value: object): ...
def add_to_collection(self, name: str, value: object) -> None: ...
def add_to_collections(self, names: Iterable[str] | str, value: object) -> None: ...
@contextmanager
def as_default(self) -> Iterator[Self]: ...
def finalize(self) -> None: ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/tensorflow/tensorflow/math.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ from tensorflow import RaggedTensor, Tensor, _TensorCompatible
from tensorflow.sparse import SparseTensor

@overload
def abs(x: _TensorCompatible, name: str | None = ...) -> Tensor: ...
def abs(x: _TensorCompatible, name: str | None = None) -> Tensor: ...
@overload
def abs(x: SparseTensor, name: str | None = ...) -> SparseTensor: ...
def abs(x: SparseTensor, name: str | None = None) -> SparseTensor: ...
@overload
def abs(x: RaggedTensor, name: str | None = ...) -> RaggedTensor: ...
def abs(x: RaggedTensor, name: str | None = None) -> RaggedTensor: ...
def __getattr__(name: str) -> Incomplete: ...
0