keras-nightly 3.12.0.dev2025090103__py3-none-any.whl → 3.12.0.dev2025090303__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.
- keras/src/backend/jax/layer.py +3 -1
- keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/validation.py +5 -5
- keras/src/ops/operation.py +88 -26
- keras/src/version.py +1 -1
- {keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/METADATA +1 -1
- {keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/RECORD +8 -8
- {keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/WHEEL +0 -0
- {keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/top_level.txt +0 -0
keras/src/backend/jax/layer.py
CHANGED
@@ -3,7 +3,9 @@ from keras.src.backend.config import is_nnx_enabled
|
|
3
3
|
if is_nnx_enabled():
|
4
4
|
from flax import nnx
|
5
5
|
|
6
|
-
BaseLayer
|
6
|
+
class BaseLayer(nnx.Module):
|
7
|
+
def __init_subclass__(cls, **kwargs):
|
8
|
+
super().__init_subclass__(pytree=False, **kwargs)
|
7
9
|
else:
|
8
10
|
BaseLayer = object
|
9
11
|
|
@@ -7,7 +7,7 @@ def _classes_shape(batched, classes_shape, max_boxes):
|
|
7
7
|
return None
|
8
8
|
if batched:
|
9
9
|
return [None, max_boxes] + classes_shape[2:]
|
10
|
-
return [max_boxes] + classes_shape[
|
10
|
+
return [max_boxes] + classes_shape[1:]
|
11
11
|
|
12
12
|
|
13
13
|
def _box_shape(batched, boxes_shape, max_boxes):
|
@@ -91,20 +91,20 @@ def densify_bounding_boxes(
|
|
91
91
|
labels_default_value for _ in range(num_boxes_to_add)
|
92
92
|
]
|
93
93
|
return {
|
94
|
-
"boxes": backend.convert_to_tensor(new_boxes, dtype="
|
95
|
-
"labels": backend.convert_to_tensor(
|
94
|
+
"boxes": backend.convert_to_tensor(new_boxes, dtype="float32"),
|
95
|
+
"labels": backend.convert_to_tensor(new_labels, dtype="int32"),
|
96
96
|
}
|
97
97
|
|
98
98
|
if tf_utils.is_ragged_tensor(boxes):
|
99
99
|
bounding_boxes["boxes"] = bounding_boxes["boxes"].to_tensor(
|
100
100
|
default_value=boxes_default_value,
|
101
|
-
shape=
|
101
|
+
shape=_box_shape(
|
102
102
|
is_batched, bounding_boxes["boxes"].shape, max_boxes
|
103
103
|
),
|
104
104
|
)
|
105
105
|
bounding_boxes["labels"] = bounding_boxes["labels"].to_tensor(
|
106
106
|
default_value=labels_default_value,
|
107
|
-
shape=
|
107
|
+
shape=_classes_shape(
|
108
108
|
is_batched, bounding_boxes["labels"].shape, max_boxes
|
109
109
|
),
|
110
110
|
)
|
keras/src/ops/operation.py
CHANGED
@@ -130,15 +130,55 @@ class Operation(KerasSaveable):
|
|
130
130
|
vars(instance)["_object__state"] = nnx.object.ObjectState()
|
131
131
|
|
132
132
|
# Generate a config to be returned by default by `get_config()`.
|
133
|
-
|
134
|
-
|
133
|
+
auto_config = True
|
134
|
+
|
135
|
+
signature = inspect.signature(cls.__init__)
|
136
|
+
argspec = inspect.getfullargspec(cls.__init__)
|
137
|
+
|
138
|
+
try:
|
139
|
+
bound_parameters = signature.bind(None, *args, **kwargs)
|
140
|
+
except TypeError:
|
141
|
+
# Raised by signature.bind when the supplied args and kwargs
|
142
|
+
# do not match the signature.
|
143
|
+
auto_config = False
|
144
|
+
|
145
|
+
if auto_config and any(
|
146
|
+
[
|
147
|
+
param.kind == inspect.Parameter.POSITIONAL_ONLY
|
148
|
+
for name, param in signature.parameters.items()
|
149
|
+
if name != argspec.args[0]
|
150
|
+
]
|
151
|
+
):
|
152
|
+
# cls.__init__ takes positional only arguments, which
|
153
|
+
# cannot be restored via cls(**config)
|
154
|
+
auto_config = False
|
155
|
+
# Create variable to show appropriate warning in get_config.
|
156
|
+
instance._auto_config_error_args = True
|
157
|
+
|
158
|
+
if auto_config:
|
159
|
+
# Include default values in the config.
|
160
|
+
bound_parameters.apply_defaults()
|
161
|
+
# Extract all arguments as a dictionary.
|
162
|
+
kwargs = bound_parameters.arguments
|
163
|
+
# Expand variable kwargs argument.
|
164
|
+
kwargs |= kwargs.pop(argspec.varkw, {})
|
165
|
+
# Remove first positional argument, self.
|
166
|
+
kwargs.pop(argspec.args[0])
|
167
|
+
# Remove argument "name", as it is provided by get_config.
|
168
|
+
kwargs.pop("name", None)
|
169
|
+
if argspec.varargs is not None:
|
170
|
+
# Varargs cannot be meaningfully converted to a dictionary.
|
171
|
+
varargs = kwargs.pop(argspec.varargs)
|
172
|
+
if len(varargs) > 0:
|
173
|
+
auto_config = False
|
174
|
+
# Store variable to show appropriate warning in get_config.
|
175
|
+
instance._auto_config_error_args = True
|
135
176
|
|
136
177
|
# For safety, we only rely on auto-configs for a small set of
|
137
178
|
# serializable types.
|
138
179
|
supported_types = (str, int, float, bool, type(None))
|
139
180
|
try:
|
140
181
|
flat_arg_values = tree.flatten(kwargs)
|
141
|
-
auto_config = True
|
142
182
|
for value in flat_arg_values:
|
143
183
|
if not isinstance(value, supported_types):
|
144
184
|
auto_config = False
|
@@ -193,30 +233,52 @@ class Operation(KerasSaveable):
|
|
193
233
|
config.pop("name", None)
|
194
234
|
return config
|
195
235
|
else:
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
236
|
+
example_str = """
|
237
|
+
class CustomLayer(keras.layers.Layer):
|
238
|
+
def __init__(self, arg1, arg2, **kwargs):
|
239
|
+
super().__init__(**kwargs)
|
240
|
+
self.arg1 = arg1
|
241
|
+
self.arg2 = arg2
|
242
|
+
|
243
|
+
def get_config(self):
|
244
|
+
config = super().get_config()
|
245
|
+
config.update({
|
246
|
+
"arg1": self.arg1,
|
247
|
+
"arg2": self.arg2,
|
248
|
+
})
|
249
|
+
return config
|
250
|
+
"""
|
251
|
+
if getattr(self, "_auto_config_error_args", False):
|
252
|
+
raise NotImplementedError(
|
253
|
+
textwrap.dedent(
|
254
|
+
f"""
|
255
|
+
Object {self.__class__.__name__} was created by passing
|
256
|
+
positional only or variadic positional arguments (e.g.,
|
257
|
+
`*args`) to `__init__()`, which is not supported by the
|
258
|
+
automatic config generation. Please remove all positional
|
259
|
+
only and variadic arguments from `__init__()`
|
260
|
+
or override `get_config()` and `from_config()` to make
|
261
|
+
the object serializatble.
|
262
|
+
|
263
|
+
Example:
|
264
|
+
|
265
|
+
{example_str}"""
|
266
|
+
)
|
267
|
+
)
|
268
|
+
else:
|
269
|
+
raise NotImplementedError(
|
270
|
+
textwrap.dedent(
|
271
|
+
f"""
|
272
|
+
Object {self.__class__.__name__} was created by passing
|
273
|
+
non-serializable argument values in `__init__()`,
|
274
|
+
and therefore the object must override `get_config()` in
|
275
|
+
order to be serializable. Please implement `get_config()`.
|
276
|
+
|
277
|
+
Example:
|
278
|
+
|
279
|
+
{example_str}"""
|
280
|
+
)
|
218
281
|
)
|
219
|
-
)
|
220
282
|
|
221
283
|
@classmethod
|
222
284
|
def from_config(cls, config):
|
keras/src/version.py
CHANGED
{keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/RECORD
RENAMED
@@ -126,7 +126,7 @@ keras/regularizers/__init__.py,sha256=542Shphw7W8h4Dyf2rmqMKUECVZ8IVBvN9g1LWhz-b
|
|
126
126
|
keras/saving/__init__.py,sha256=KvL2GZxjvgFgEhvEnkvqjIR9JSNHKz-NWZacXajsjLI,1298
|
127
127
|
keras/src/__init__.py,sha256=Gi4S7EiCMkE03PbdGNpFdaUYySWDs_FcAJ8Taz9Y1BE,684
|
128
128
|
keras/src/api_export.py,sha256=gXOkBOnmscV013WAc75lc4Up01-Kkg9EylIAT_QWctg,1173
|
129
|
-
keras/src/version.py,sha256=
|
129
|
+
keras/src/version.py,sha256=10rfmpGBb6KJKrifewkNq8aWHatUOvbKV8SoOP3HJUw,204
|
130
130
|
keras/src/activations/__init__.py,sha256=0nL3IFDB9unlrMz8ninKOWo-uCHasTUpTo1tXZb2u44,4433
|
131
131
|
keras/src/activations/activations.py,sha256=mogPggtp4CGldI3VOPNmesRxp6EbiR1_i4KLGaVwzL8,17614
|
132
132
|
keras/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -165,7 +165,7 @@ keras/src/backend/jax/core.py,sha256=kd2-Q3Nm5zp7YwyO_d6ZFlqUCPKP7_hVFAUrgD_FvIU
|
|
165
165
|
keras/src/backend/jax/distribution_lib.py,sha256=-pm5qtFbzTgg_Z7sxq30x4Mjdopn-6qgXFysWoNLtZo,8663
|
166
166
|
keras/src/backend/jax/export.py,sha256=jV2yKQLzYjK72vTJmdNomWPLeNS_lDTCEKzQx_5D_-E,7368
|
167
167
|
keras/src/backend/jax/image.py,sha256=RiYIalbIaUQdDOGpDZUBk5KNsX94Xqg7iyXGATN9V58,30482
|
168
|
-
keras/src/backend/jax/layer.py,sha256=
|
168
|
+
keras/src/backend/jax/layer.py,sha256=o6CicT06udwamTRQIjNSDLZLyYHFzBXNbxewXgWe0iw,308
|
169
169
|
keras/src/backend/jax/linalg.py,sha256=dtGHRYCvoVlRX0UwbDDdunA8Vp_mA3sdqoasX4P8SbQ,2532
|
170
170
|
keras/src/backend/jax/math.py,sha256=1IEDpdoF8e5ltu3D4wbDQuihzvJHhMXz8W9Z_E-eJqU,9391
|
171
171
|
keras/src/backend/jax/nn.py,sha256=R0a8-WB0YCl14FpRi2CQ45MFRvHCFtPTedk0Q1LfWYc,45935
|
@@ -410,7 +410,7 @@ keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/bounding_box.p
|
|
410
410
|
keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/converters.py,sha256=opXlmX5SRiWEU2_M1PqkiBVi8LRNfIIDMPMfMY_2Yp0,15999
|
411
411
|
keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/formats.py,sha256=b4v7nskUauUvk7Ub4rgImPUysJrDl4m5oBTGD1MEnTI,3377
|
412
412
|
keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/iou.py,sha256=ZwqkN4d2QoYlK6sIv2OJ7MkRyObLmdRMKflb1Tp0YJ4,10140
|
413
|
-
keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/validation.py,sha256=
|
413
|
+
keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/validation.py,sha256=BIbkLBosoWWXAiqqgeDcg7w7NpP3K9ODXWrv1TYceFo,7192
|
414
414
|
keras/src/layers/regularization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
415
415
|
keras/src/layers/regularization/activity_regularization.py,sha256=FCUAcb3Pyotp2lmoks6Ixb6lmNfg-Pa4eGgW6C7S5zQ,1283
|
416
416
|
keras/src/layers/regularization/alpha_dropout.py,sha256=z2Kl3Pblx4eZnJWUiAUgUogu4A1pTPclwzH_Sa-B4Fs,3625
|
@@ -490,7 +490,7 @@ keras/src/ops/math.py,sha256=4qYMJ5qAPmeSyeF63YWoGbUkQt6f4_VX0enOChU4mXU,37233
|
|
490
490
|
keras/src/ops/nn.py,sha256=1BC-zmnpsUhqG5lSE4VvV5PsBf81wN0ZGg4kU-R8TJY,95259
|
491
491
|
keras/src/ops/node.py,sha256=aJgn9D-GkteE--Bbt2cZ9JjVxb2W2uS1OWEKoeLsl3Y,5583
|
492
492
|
keras/src/ops/numpy.py,sha256=ovWnm3XHDIzjiwjm_GjM0oVZHCGige7Ek95cX4qCAvk,236694
|
493
|
-
keras/src/ops/operation.py,sha256=
|
493
|
+
keras/src/ops/operation.py,sha256=dpPI6bQsdBk6j0EUNygoLRHngrMTDoqT2Z55mgq6hbE,15520
|
494
494
|
keras/src/ops/operation_utils.py,sha256=BSarr5DZF5dr-URdXNzawwZlFx6R7VRjh6P2DGwgrT4,14457
|
495
495
|
keras/src/ops/symbolic_arguments.py,sha256=MKwXxZYkyouD9BPmQ1uUNxILdcwPvTayAqXaUV3P3o4,1628
|
496
496
|
keras/src/optimizers/__init__.py,sha256=k7AmJUexCuGHTvU5gCrL_Pf7XYQmA6dZjJ47kcLvqfk,3974
|
@@ -597,7 +597,7 @@ keras/utils/bounding_boxes/__init__.py,sha256=jtvQll4u8ZY0Z96HwNhP1nxWEG9FM3gI-6
|
|
597
597
|
keras/utils/legacy/__init__.py,sha256=oSYZz6uS8UxSElRaaJYWJEoweJ4GAasZjnn7fNaOlog,342
|
598
598
|
keras/visualization/__init__.py,sha256=UKWmiy6sps4SWlmQi9WX8_Z53cPpLlphz2zIeHdwJpQ,722
|
599
599
|
keras/wrappers/__init__.py,sha256=QkS-O5K8qGS7C3sytF8MpmO6PasATpNVGF8qtb7Ojsw,407
|
600
|
-
keras_nightly-3.12.0.
|
601
|
-
keras_nightly-3.12.0.
|
602
|
-
keras_nightly-3.12.0.
|
603
|
-
keras_nightly-3.12.0.
|
600
|
+
keras_nightly-3.12.0.dev2025090303.dist-info/METADATA,sha256=rA14PbRaPmupzN7_lPZAarq7u9P8Zfkv8Ahlyd8YJWg,5970
|
601
|
+
keras_nightly-3.12.0.dev2025090303.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
602
|
+
keras_nightly-3.12.0.dev2025090303.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
|
603
|
+
keras_nightly-3.12.0.dev2025090303.dist-info/RECORD,,
|
{keras_nightly-3.12.0.dev2025090103.dist-info → keras_nightly-3.12.0.dev2025090303.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|