-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move some layers to keras.layers.preprocessing
[pre-commit.ci] auto fixes from pre-commit.com hooks
- Loading branch information
1 parent
17f66ee
commit 22c88bc
Showing
4 changed files
with
52 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
stubs/tensorflow/tensorflow/keras/layers/experimental/preprocessing.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import abc | ||
|
||
from tensorflow._aliases import TensorLike | ||
from tensorflow.keras.layers import Layer | ||
|
||
class PreprocessingLayer(Layer[TensorLike, TensorLike], metaclass=abc.ABCMeta): ... |
36 changes: 36 additions & 0 deletions
36
stubs/tensorflow/tensorflow/keras/layers/preprocessing/__init__.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import Literal | ||
|
||
from tensorflow import _TensorCompatible | ||
from tensorflow.keras.layers.preprocessing.index_lookup import IndexLookup | ||
|
||
class StringLookup(IndexLookup): | ||
def __init__( | ||
self, | ||
max_tokens: int | None = None, | ||
num_oov_indices: int = 1, | ||
mask_token: str | None = None, | ||
oov_token: str = "[UNK]", | ||
vocabulary: str | None | _TensorCompatible = None, | ||
idf_weights: _TensorCompatible | None = None, | ||
encoding: str = "utf-8", | ||
invert: bool = False, | ||
output_mode: Literal["int", "count", "multi_hot", "one_hot", "tf_idf"] = "int", | ||
sparse: bool = False, | ||
pad_to_max_tokens: bool = False, | ||
) -> None: ... | ||
|
||
class IntegerLookup(IndexLookup): | ||
def __init__( | ||
self, | ||
max_tokens: int | None = None, | ||
num_oov_indices: int = 1, | ||
mask_token: int | None = None, | ||
oov_token: int = -1, | ||
vocabulary: str | None | _TensorCompatible = None, | ||
vocabulary_dtype: Literal["int64", "int32"] = "int64", | ||
idf_weights: _TensorCompatible | None = None, | ||
invert: bool = False, | ||
output_mode: Literal["int", "count", "multi_hot", "one_hot", "tf_idf"] = "int", | ||
sparse: bool = False, | ||
pad_to_max_tokens: bool = False, | ||
) -> None: ... |
9 changes: 9 additions & 0 deletions
9
stubs/tensorflow/tensorflow/keras/layers/preprocessing/index_lookup.pyi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from _typeshed import Incomplete | ||
|
||
import tensorflow as tf | ||
from tensorflow.keras.layers.experimental.preprocessing import PreprocessingLayer | ||
|
||
class IndexLookup(PreprocessingLayer): | ||
def compute_output_signature(self, input_spec: Incomplete) -> tf.TensorSpec: ... | ||
def get_vocabulary(self, include_special_tokens: bool = True) -> list[Incomplete]: ... | ||
def vocabulary_size(self) -> int: ... |