keras-nightly 3.14.0.dev2026010404__py3-none-any.whl → 3.14.0.dev2026010604__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.
@@ -4,6 +4,7 @@ from openvino import Type
4
4
 
5
5
  from keras.src.backend import config
6
6
  from keras.src.backend.common import dtypes
7
+ from keras.src.backend.common.backend_utils import canonicalize_axis
7
8
  from keras.src.backend.common.variables import standardize_dtype
8
9
  from keras.src.backend.openvino.core import DTYPES_MAX
9
10
  from keras.src.backend.openvino.core import DTYPES_MIN
@@ -893,9 +894,53 @@ def diag(x, k=0):
893
894
 
894
895
 
895
896
  def diagonal(x, offset=0, axis1=0, axis2=1):
896
- raise NotImplementedError(
897
- "`diagonal` is not supported with openvino backend"
898
- )
897
+ x = get_ov_output(x)
898
+ shape = x.get_partial_shape()
899
+ rank = x.get_partial_shape().rank.get_length()
900
+ if rank is None:
901
+ raise ValueError("`diagonal` requires input tensor with static rank.")
902
+ if rank < 2:
903
+ raise ValueError(
904
+ f"diagonal requires input tensor with rank >= 2.Given rank: {rank}"
905
+ )
906
+ axis1 = canonicalize_axis(axis1, rank)
907
+ axis2 = canonicalize_axis(axis2, rank)
908
+ if axis1 == axis2:
909
+ raise ValueError("`axis1` and `axis2` cannot be the same.")
910
+
911
+ perm_order = [axis1, axis2] + [
912
+ i for i in range(rank) if i != axis1 and i != axis2
913
+ ]
914
+ perm_const = ov_opset.constant(perm_order, dtype=Type.i32).output(0)
915
+ x_transposed = ov_opset.transpose(x, perm_const)
916
+
917
+ N_dim = shape[axis1]
918
+ M_dim = shape[axis2]
919
+ if not N_dim.is_static or not M_dim.is_static:
920
+ raise ValueError(
921
+ "`diagonal` requires input tensor with static shape for axes "
922
+ f"`axis1` ({axis1}) and `axis2` ({axis2})."
923
+ )
924
+ N = N_dim.get_length()
925
+ M = M_dim.get_length()
926
+ if offset >= 0:
927
+ L = np.minimum(N, M - offset) if (M - offset) > 0 else 0
928
+ indices = [[i, i + offset] for i in range(L)]
929
+ else:
930
+ L = np.minimum(N + offset, M) if (N + offset) > 0 else 0
931
+ indices = [[i - offset, i] for i in range(L)]
932
+
933
+ indices = np.array(indices, dtype=np.int32).reshape(L, 2)
934
+ indices_const = ov_opset.constant(indices, dtype=Type.i32).output(0)
935
+
936
+ diag_gathered = ov_opset.gather_nd(x_transposed, indices_const)
937
+
938
+ out_rank = rank - 1
939
+ out_perm_order = list(range(1, out_rank)) + [0]
940
+ out_perm_const = ov_opset.constant(out_perm_order, dtype=Type.i32).output(0)
941
+
942
+ final_output = ov_opset.transpose(diag_gathered, out_perm_const)
943
+ return OpenVINOKerasTensor(final_output.output(0))
899
944
 
900
945
 
901
946
  def diff(a, n=1, axis=-1):
@@ -6,6 +6,7 @@ from keras.src import ops
6
6
  from keras.src import quantizers
7
7
  from keras.src.api_export import keras_export
8
8
  from keras.src.backend import KerasTensor
9
+ from keras.src.backend import set_keras_mask
9
10
  from keras.src.quantizers.quantization_config import QuantizationConfig
10
11
 
11
12
 
@@ -117,7 +118,11 @@ class ReversibleEmbedding(layers.Embedding):
117
118
 
118
119
  def call(self, inputs, reverse=False):
119
120
  if not reverse:
120
- return super().call(inputs)
121
+ result = super().call(inputs)
122
+ mask = super().compute_mask(inputs)
123
+ if mask is not None:
124
+ set_keras_mask(result, mask)
125
+ return result
121
126
  else:
122
127
  if self.tie_weights:
123
128
  kernel = ops.transpose(ops.convert_to_tensor(self.embeddings))
@@ -135,6 +140,10 @@ class ReversibleEmbedding(layers.Embedding):
135
140
  )
136
141
  return logits
137
142
 
143
+ def compute_mask(self, inputs, mask=None):
144
+ # Disable masking from super class, masking is done directly in call.
145
+ return None
146
+
138
147
  def compute_output_shape(self, input_shape, reverse=False):
139
148
  output_shape = list(input_shape)
140
149
  if reverse:
@@ -507,10 +507,14 @@ class FeatureSpace(Layer):
507
507
 
508
508
  def adapt(self, dataset):
509
509
  if not isinstance(dataset, tf.data.Dataset):
510
- raise ValueError(
511
- "`adapt()` can only be called on a tf.data.Dataset. "
512
- f"Received instead: {dataset} (of type {type(dataset)})"
513
- )
510
+ if isinstance(dataset, dict):
511
+ dataset = tf.data.Dataset.from_tensor_slices(dataset)
512
+ else:
513
+ raise ValueError(
514
+ "`adapt()` can only be called on a tf.data.Dataset or a "
515
+ "dict of arrays/lists. "
516
+ f"Received instead: {dataset} (of type {type(dataset)})"
517
+ )
514
518
 
515
519
  for name in self._list_adaptable_preprocessors():
516
520
  # Call adapt() on each individual adaptable layer.
@@ -66,6 +66,16 @@ class Resizing(BaseImagePreprocessingLayer):
66
66
  `~/.keras/keras.json`. If you never set it, then it will be
67
67
  `"channels_last"`.
68
68
  **kwargs: Base layer keyword arguments, such as `name` and `dtype`.
69
+
70
+ Example:
71
+
72
+ ```python
73
+ (x_train, y_train), _ = keras.datasets.cifar10.load_data()
74
+ image = x_train[0]
75
+ resizer = keras.layers.Resizing(128, 128)
76
+ resized_image = resizer(image)
77
+ print("original:", image.shape, "resized:", resized_image.shape)
78
+ ```
69
79
  """
70
80
 
71
81
  _USE_BASE_FACTOR = False
@@ -31,13 +31,13 @@ def no_automatic_dependency_tracking(fn):
31
31
  class Tracker:
32
32
  """Attribute tracker, used for e.g. Variable tracking.
33
33
 
34
- Monitors certain attribute types
35
- and put them in appropriate lists in case of a match.
34
+ Monitors certain attribute types and places matching
35
+ objects into user provided tracking collections.
36
36
 
37
37
  Also passively tracks certain mutable collections
38
- (dict, list) so that items added to them later
39
- still get tracked. This is done by wrapping these
40
- collections into an equivalent, tracking-aware object.
38
+ (e.g. dict and list) ensuring that items added after
39
+ initialization are still tracked. This is done by wrapping
40
+ these collections in tracking-aware proxy objects.
41
41
 
42
42
  Example:
43
43
 
keras/src/version.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from keras.src.api_export import keras_export
2
2
 
3
3
  # Unique source of truth for the version number.
4
- __version__ = "3.14.0.dev2026010404"
4
+ __version__ = "3.14.0.dev2026010604"
5
5
 
6
6
 
7
7
  @keras_export("keras.version")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keras-nightly
3
- Version: 3.14.0.dev2026010404
3
+ Version: 3.14.0.dev2026010604
4
4
  Summary: Multi-backend Keras
5
5
  Author-email: Keras team <keras-users@googlegroups.com>
6
6
  License: Apache License 2.0
@@ -128,7 +128,7 @@ keras/regularizers/__init__.py,sha256=542Shphw7W8h4Dyf2rmqMKUECVZ8IVBvN9g1LWhz-b
128
128
  keras/saving/__init__.py,sha256=KvL2GZxjvgFgEhvEnkvqjIR9JSNHKz-NWZacXajsjLI,1298
129
129
  keras/src/__init__.py,sha256=Gi4S7EiCMkE03PbdGNpFdaUYySWDs_FcAJ8Taz9Y1BE,684
130
130
  keras/src/api_export.py,sha256=gXOkBOnmscV013WAc75lc4Up01-Kkg9EylIAT_QWctg,1173
131
- keras/src/version.py,sha256=NEO1HgGpuG1Z5D3BQwOOFlznAtMOXmlDGFdR99milbM,204
131
+ keras/src/version.py,sha256=p7VwTUiL7-M3NHKfCGkEw-zmkZ9iSq5k6kLnHt6L5es,204
132
132
  keras/src/activations/__init__.py,sha256=0nL3IFDB9unlrMz8ninKOWo-uCHasTUpTo1tXZb2u44,4433
133
133
  keras/src/activations/activations.py,sha256=mogPggtp4CGldI3VOPNmesRxp6EbiR1_i4KLGaVwzL8,17614
134
134
  keras/src/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -198,7 +198,7 @@ keras/src/backend/openvino/layer.py,sha256=5RdvaH1yOyPAphjKiuQAK1H_yZFYKE1Hp7c5b
198
198
  keras/src/backend/openvino/linalg.py,sha256=L6a4MFGND2wWzPVCh44cwuOgkcC4wJTo8Xy3HwW04lg,1614
199
199
  keras/src/backend/openvino/math.py,sha256=qw9kX2sJ2qr0dBJF12Ey0E2GcwixPUqoev6UcNra4NI,3944
200
200
  keras/src/backend/openvino/nn.py,sha256=zULPxdwVO7JDZUUtsuoEEPCLQ09ew8z8T6G_i_NEqrM,23741
201
- keras/src/backend/openvino/numpy.py,sha256=4VMuzxuCd2ig5QA9npSfn47bHxVAmWK920mOEvd9y-8,97883
201
+ keras/src/backend/openvino/numpy.py,sha256=oMKzAuAK0zRA5vgUiyttCm-fW4zvH450Hb8-hiEgSnY,99683
202
202
  keras/src/backend/openvino/random.py,sha256=4hRUtIP6qJxO3Qy9uH1x6jSuJna3nWPdUf4x2QU8-ew,5575
203
203
  keras/src/backend/openvino/rnn.py,sha256=ErmuZLPSgG9qU-NfYPPvBZ6Ysy8k-fA4g19Vhqq7OVQ,866
204
204
  keras/src/backend/openvino/trainer.py,sha256=bMmtSALqydqdS6ke-5sYW5fgxZDshDH810p_C0xCRTg,9087
@@ -331,7 +331,7 @@ keras/src/layers/core/identity.py,sha256=o0gLHlXL7eNJEbXIgIsgBsZX97K6jN9n3qPXprk
331
331
  keras/src/layers/core/input_layer.py,sha256=RQn1KHtUd6fPBPL9rs46X8KHmr1eGo7moLg8U5tlVl0,8168
332
332
  keras/src/layers/core/lambda_layer.py,sha256=Wplek4hOwh_rwXz4_bpz0pXzKe26ywz52glh5uD0l4w,9272
333
333
  keras/src/layers/core/masking.py,sha256=g-RrZ_P50Surh_KGlZQwy2kPNLsop0F8voU4SG2MQkw,2856
334
- keras/src/layers/core/reversible_embedding.py,sha256=vHQYejplZs7o-1D8Jcc1hSQKmIwNZub2-ZQKRHEbnJA,15810
334
+ keras/src/layers/core/reversible_embedding.py,sha256=nDQ7b-xi9YlHxYZv0Vif0qr3bfu3LAWR_d1KrDsMawI,16155
335
335
  keras/src/layers/core/wrapper.py,sha256=KIdDBuk24V9rAn97-HUUKQ0JMx9Eyd0q9W4qQFaYNt8,1509
336
336
  keras/src/layers/merging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  keras/src/layers/merging/add.py,sha256=icbh3RwZ3QUP3bFNCi7GbrHj2hFdKu1Dsv8djSa13co,2150
@@ -376,7 +376,7 @@ keras/src/layers/preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
376
376
  keras/src/layers/preprocessing/category_encoding.py,sha256=RjgVkFi9og1hHNmDu2DuKVQOO2Yd-LSXKJDSSzG876M,6927
377
377
  keras/src/layers/preprocessing/data_layer.py,sha256=5bO2Pjs-mOzn4z5OnwBbbF3shOczLmimYVym9UL0Mcc,5766
378
378
  keras/src/layers/preprocessing/discretization.py,sha256=vsBQbIqlore_NlU0LvtqiDriCXguD_CZH7tK91LBhGM,14056
379
- keras/src/layers/preprocessing/feature_space.py,sha256=-cB4tpfk2RovCUJ3AXMsNPtVfUvfqvExqMPyOa6W3aA,30373
379
+ keras/src/layers/preprocessing/feature_space.py,sha256=YcHzD8C5eqUDRF8khLapwc8qCmbJSfix16KyzqEu1II,30568
380
380
  keras/src/layers/preprocessing/hashed_crossing.py,sha256=uwOTKPsv2UweHuGiF4V5HFRgYnjP8N0_S6qT3JP5KeQ,8481
381
381
  keras/src/layers/preprocessing/hashing.py,sha256=3k1L_2d_bROHxZNjDbfURRBSFzFBIHFj0tEXCobcS8w,11188
382
382
  keras/src/layers/preprocessing/index_lookup.py,sha256=JPtnH-dbzLW72F8T5sZqsc3_aQ9Ml79RWQzTjhpbXq4,42991
@@ -418,7 +418,7 @@ keras/src/layers/preprocessing/image_preprocessing/random_sharpness.py,sha256=4R
418
418
  keras/src/layers/preprocessing/image_preprocessing/random_shear.py,sha256=uEr1iCCAHdpIhAVz2VZh7u82NEYtiM9eMIhvvIQyA9A,15020
419
419
  keras/src/layers/preprocessing/image_preprocessing/random_translation.py,sha256=1l1Oufpsu54SunSrrBb-nq6cM9ANehgHJxWx40sTPig,14932
420
420
  keras/src/layers/preprocessing/image_preprocessing/random_zoom.py,sha256=DBDSep-CGk-lsWP0gwP89SQR2k8-ZjYqKKj0rf-KWWA,16472
421
- keras/src/layers/preprocessing/image_preprocessing/resizing.py,sha256=7aNl_4UENFadtTPehP9KxjJk2FD7TRLeTiL27FZ6muQ,11968
421
+ keras/src/layers/preprocessing/image_preprocessing/resizing.py,sha256=N3_Mw4KA-DC7R0zBNeRnCQWvzKa8Bpg1jRooUJSZLq0,12241
422
422
  keras/src/layers/preprocessing/image_preprocessing/solarization.py,sha256=URBAHjCIRs8mlb1RCt39pHtylRgZuhxC7kFtACsGIbc,8015
423
423
  keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
424
424
  keras/src/layers/preprocessing/image_preprocessing/bounding_boxes/bounding_box.py,sha256=GVnRIE2NRecj8aKtslg26GIp1I1rTHurFFUEvfd_e-0,16260
@@ -597,7 +597,7 @@ keras/src/utils/tf_utils.py,sha256=FTunWC5kdyjsK0TyxQxiHGaYNaAyUxhMX52Zee_Rz9c,4
597
597
  keras/src/utils/timeseries_dataset_utils.py,sha256=rVxSuqlYLpzw_dVo8Ym5HSE2jFmndS8MAv4Uewycojo,9842
598
598
  keras/src/utils/torch_utils.py,sha256=n0CAb7NFnK3CcfxY9VgA2kcZp_8SU05Ddg-KY0-qnoc,6619
599
599
  keras/src/utils/traceback_utils.py,sha256=VI8VJ8QjTDc3-cx3xfR9H7g68D2KVH7VknHi_JrVMuU,8997
600
- keras/src/utils/tracking.py,sha256=KUTZdgBzVJ0gzgra5ieGNLW2D8wjnnPRpwk78d9NWGs,10761
600
+ keras/src/utils/tracking.py,sha256=rH6X-W8C4UG1ni6lzPB7EnOvYU9MsDUaQb1ox3zs2ms,10787
601
601
  keras/src/visualization/__init__.py,sha256=bDdV3eLKeLKoUwUDBFuZxMO560OyFZND0zBn8vaG6rg,111
602
602
  keras/src/visualization/draw_bounding_boxes.py,sha256=Gs7gNburpgwXr8CahiyQgZWhBD5ffVeoUG7kzIFL92g,6649
603
603
  keras/src/visualization/draw_segmentation_masks.py,sha256=CAqZ0gNM-ufuL3sFtoDpzZfsGKxn7WcqmkjmWnvaGdA,4741
@@ -614,7 +614,7 @@ keras/utils/bounding_boxes/__init__.py,sha256=jtvQll4u8ZY0Z96HwNhP1nxWEG9FM3gI-6
614
614
  keras/utils/legacy/__init__.py,sha256=oSYZz6uS8UxSElRaaJYWJEoweJ4GAasZjnn7fNaOlog,342
615
615
  keras/visualization/__init__.py,sha256=UKWmiy6sps4SWlmQi9WX8_Z53cPpLlphz2zIeHdwJpQ,722
616
616
  keras/wrappers/__init__.py,sha256=QkS-O5K8qGS7C3sytF8MpmO6PasATpNVGF8qtb7Ojsw,407
617
- keras_nightly-3.14.0.dev2026010404.dist-info/METADATA,sha256=izccHqM_XYFkZxlY1iynXDh9WTUKmWaCAW9AHa_7U5w,6339
618
- keras_nightly-3.14.0.dev2026010404.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
619
- keras_nightly-3.14.0.dev2026010404.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
620
- keras_nightly-3.14.0.dev2026010404.dist-info/RECORD,,
617
+ keras_nightly-3.14.0.dev2026010604.dist-info/METADATA,sha256=Z53_wtxCa3KlHe9m1KZL4qghMBM-_VdDmv5zWizF9vE,6339
618
+ keras_nightly-3.14.0.dev2026010604.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
619
+ keras_nightly-3.14.0.dev2026010604.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
620
+ keras_nightly-3.14.0.dev2026010604.dist-info/RECORD,,