tf-keras-nightly 2.20.0.dev2025062209__py3-none-any.whl → 2.20.0.dev2025082818__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tf-keras-nightly might be problematic. Click here for more details.
- tf_keras/__init__.py +1 -1
- tf_keras/protobuf/projector_config_pb2.py +23 -12
- tf_keras/protobuf/saved_metadata_pb2.py +21 -10
- tf_keras/protobuf/versions_pb2.py +19 -8
- tf_keras/src/metrics/confusion_metrics.py +47 -1
- tf_keras/src/models/sharpness_aware_minimization.py +17 -7
- tf_keras/src/utils/metrics_utils.py +4 -1
- {tf_keras_nightly-2.20.0.dev2025062209.dist-info → tf_keras_nightly-2.20.0.dev2025082818.dist-info}/METADATA +1 -1
- {tf_keras_nightly-2.20.0.dev2025062209.dist-info → tf_keras_nightly-2.20.0.dev2025082818.dist-info}/RECORD +11 -33
- tf_keras/src/layers/preprocessing/benchmarks/bucketized_column_dense_benchmark.py +0 -85
- tf_keras/src/layers/preprocessing/benchmarks/category_encoding_benchmark.py +0 -84
- tf_keras/src/layers/preprocessing/benchmarks/category_hash_dense_benchmark.py +0 -89
- tf_keras/src/layers/preprocessing/benchmarks/category_hash_varlen_benchmark.py +0 -89
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_file_dense_benchmark.py +0 -110
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_file_varlen_benchmark.py +0 -103
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_list_dense_benchmark.py +0 -87
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_list_indicator_dense_benchmark.py +0 -96
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_list_indicator_varlen_benchmark.py +0 -96
- tf_keras/src/layers/preprocessing/benchmarks/category_vocab_list_varlen_benchmark.py +0 -87
- tf_keras/src/layers/preprocessing/benchmarks/discretization_adapt_benchmark.py +0 -109
- tf_keras/src/layers/preprocessing/benchmarks/embedding_dense_benchmark.py +0 -86
- tf_keras/src/layers/preprocessing/benchmarks/embedding_varlen_benchmark.py +0 -89
- tf_keras/src/layers/preprocessing/benchmarks/hashed_crossing_benchmark.py +0 -90
- tf_keras/src/layers/preprocessing/benchmarks/hashing_benchmark.py +0 -105
- tf_keras/src/layers/preprocessing/benchmarks/image_preproc_benchmark.py +0 -159
- tf_keras/src/layers/preprocessing/benchmarks/index_lookup_adapt_benchmark.py +0 -135
- tf_keras/src/layers/preprocessing/benchmarks/index_lookup_forward_benchmark.py +0 -144
- tf_keras/src/layers/preprocessing/benchmarks/normalization_adapt_benchmark.py +0 -124
- tf_keras/src/layers/preprocessing/benchmarks/weighted_embedding_varlen_benchmark.py +0 -99
- tf_keras/src/saving/legacy/saved_model/create_test_saved_model.py +0 -37
- tf_keras/src/tests/keras_doctest.py +0 -159
- {tf_keras_nightly-2.20.0.dev2025062209.dist-info → tf_keras_nightly-2.20.0.dev2025082818.dist-info}/WHEEL +0 -0
- {tf_keras_nightly-2.20.0.dev2025062209.dist-info → tf_keras_nightly-2.20.0.dev2025082818.dist-info}/top_level.txt +0 -0
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
# ==============================================================================
|
|
15
|
-
"""Run doctests for tensorflow."""
|
|
16
|
-
|
|
17
|
-
from __future__ import absolute_import
|
|
18
|
-
from __future__ import division
|
|
19
|
-
from __future__ import print_function
|
|
20
|
-
|
|
21
|
-
import os
|
|
22
|
-
import sys
|
|
23
|
-
|
|
24
|
-
import numpy as np
|
|
25
|
-
import tensorflow.compat.v2 as tf
|
|
26
|
-
from absl import flags
|
|
27
|
-
from absl.testing import absltest
|
|
28
|
-
|
|
29
|
-
from tf_keras.src.testing_infra import keras_doctest_lib
|
|
30
|
-
|
|
31
|
-
tf.compat.v1.enable_v2_behavior()
|
|
32
|
-
|
|
33
|
-
# We put doctest after absltest so that it picks up the unittest monkeypatch.
|
|
34
|
-
# Otherwise doctest tests aren't runnable at all.
|
|
35
|
-
import doctest # noqa: E402
|
|
36
|
-
|
|
37
|
-
FLAGS = flags.FLAGS
|
|
38
|
-
|
|
39
|
-
flags.DEFINE_string("module", None, "A specific module to run doctest on.")
|
|
40
|
-
flags.DEFINE_boolean(
|
|
41
|
-
"list", None, "List all the modules in the core package imported."
|
|
42
|
-
)
|
|
43
|
-
flags.DEFINE_string("file", None, "A specific file to run doctest on.")
|
|
44
|
-
|
|
45
|
-
flags.mark_flags_as_mutual_exclusive(["module", "file"])
|
|
46
|
-
flags.mark_flags_as_mutual_exclusive(["list", "file"])
|
|
47
|
-
|
|
48
|
-
PACKAGE = "keras."
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
def find_modules():
|
|
52
|
-
"""Finds all the modules in the core package imported.
|
|
53
|
-
|
|
54
|
-
Returns:
|
|
55
|
-
A list containing all the modules in tensorflow.python.
|
|
56
|
-
"""
|
|
57
|
-
|
|
58
|
-
tf_modules = []
|
|
59
|
-
for name, module in sys.modules.items():
|
|
60
|
-
if name.startswith(PACKAGE):
|
|
61
|
-
tf_modules.append(module)
|
|
62
|
-
|
|
63
|
-
return tf_modules
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def filter_on_submodules(all_modules, submodule):
|
|
67
|
-
"""Filters all the modules based on the module flag.
|
|
68
|
-
|
|
69
|
-
The module flag has to be relative to the core package imported.
|
|
70
|
-
For example, if `submodule=keras.layers` then, this function will return
|
|
71
|
-
all the modules in the submodule.
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
all_modules: All the modules in the core package.
|
|
75
|
-
submodule: Submodule to filter from all the modules.
|
|
76
|
-
|
|
77
|
-
Returns:
|
|
78
|
-
All the modules in the submodule.
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
filtered_modules = [
|
|
82
|
-
mod for mod in all_modules if PACKAGE + submodule in mod.__name__
|
|
83
|
-
]
|
|
84
|
-
return filtered_modules
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def get_module_and_inject_docstring(file_path):
|
|
88
|
-
"""Replaces the docstring of the module with the changed file's content.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
file_path: Path to the file
|
|
92
|
-
|
|
93
|
-
Returns:
|
|
94
|
-
A list containing the module changed by the file.
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
file_path = os.path.abspath(file_path)
|
|
98
|
-
mod_index = file_path.find(PACKAGE.replace(".", os.sep))
|
|
99
|
-
file_mod_name, _ = os.path.splitext(file_path[mod_index:])
|
|
100
|
-
file_module = sys.modules[file_mod_name.replace(os.sep, ".")]
|
|
101
|
-
|
|
102
|
-
with open(file_path, "r") as f:
|
|
103
|
-
content = f.read()
|
|
104
|
-
|
|
105
|
-
file_module.__doc__ = content
|
|
106
|
-
|
|
107
|
-
return [file_module]
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class TfTestCase(tf.test.TestCase):
|
|
111
|
-
def set_up(self, _):
|
|
112
|
-
self.setUp()
|
|
113
|
-
|
|
114
|
-
def tear_down(self, _):
|
|
115
|
-
self.tearDown()
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def load_tests(unused_loader, tests, unused_ignore):
|
|
119
|
-
"""Loads all the tests in the docstrings and runs them."""
|
|
120
|
-
|
|
121
|
-
tf_modules = find_modules()
|
|
122
|
-
|
|
123
|
-
if FLAGS.module:
|
|
124
|
-
tf_modules = filter_on_submodules(tf_modules, FLAGS.module)
|
|
125
|
-
|
|
126
|
-
if FLAGS.list:
|
|
127
|
-
print("**************************************************")
|
|
128
|
-
for mod in tf_modules:
|
|
129
|
-
print(mod.__name__)
|
|
130
|
-
print("**************************************************")
|
|
131
|
-
return tests
|
|
132
|
-
|
|
133
|
-
if FLAGS.file:
|
|
134
|
-
tf_modules = get_module_and_inject_docstring(FLAGS.file)
|
|
135
|
-
|
|
136
|
-
for module in tf_modules:
|
|
137
|
-
testcase = TfTestCase()
|
|
138
|
-
tests.addTests(
|
|
139
|
-
doctest.DocTestSuite(
|
|
140
|
-
module,
|
|
141
|
-
test_finder=doctest.DocTestFinder(exclude_empty=False),
|
|
142
|
-
extraglobs={"tf": tf, "np": np, "os": os},
|
|
143
|
-
setUp=testcase.set_up,
|
|
144
|
-
tearDown=testcase.tear_down,
|
|
145
|
-
checker=keras_doctest_lib.KerasDoctestOutputChecker(),
|
|
146
|
-
optionflags=(
|
|
147
|
-
doctest.ELLIPSIS
|
|
148
|
-
| doctest.NORMALIZE_WHITESPACE
|
|
149
|
-
| doctest.IGNORE_EXCEPTION_DETAIL
|
|
150
|
-
| doctest.DONT_ACCEPT_BLANKLINE
|
|
151
|
-
),
|
|
152
|
-
)
|
|
153
|
-
)
|
|
154
|
-
return tests
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
if __name__ == "__main__":
|
|
158
|
-
absltest.main()
|
|
159
|
-
|
|
File without changes
|
|
File without changes
|