keras-nightly 3.12.0.dev2025090603__py3-none-any.whl → 3.12.0.dev2025090903__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.
@@ -1064,9 +1064,53 @@ def log2(x):
1064
1064
 
1065
1065
 
1066
1066
  def logaddexp(x1, x2):
1067
- raise NotImplementedError(
1068
- "`logaddexp` is not supported with openvino backend"
1069
- )
1067
+ element_type = None
1068
+ if isinstance(x1, OpenVINOKerasTensor):
1069
+ element_type = x1.output.get_element_type()
1070
+ if isinstance(x2, OpenVINOKerasTensor):
1071
+ element_type = x2.output.get_element_type()
1072
+ x1 = get_ov_output(x1, element_type)
1073
+ x2 = get_ov_output(x2, element_type)
1074
+ x1, x2 = _align_operand_types(x1, x2, "logaddexp()")
1075
+
1076
+ if x1.element_type.is_integral() or x2.element_type.is_integral():
1077
+ float_dtype = OPENVINO_DTYPES[config.floatx()]
1078
+ if x1.element_type.is_integral():
1079
+ x1 = ov_opset.convert(x1, float_dtype)
1080
+ if x2.element_type.is_integral():
1081
+ x2 = ov_opset.convert(x2, float_dtype)
1082
+
1083
+ # Get the output nodes properly
1084
+ max_val_node = ov_opset.maximum(x1, x2)
1085
+ max_val = max_val_node.output(0)
1086
+
1087
+ # Compute absolute difference
1088
+ sub_node = ov_opset.subtract(x1, x2)
1089
+ abs_diff_node = ov_opset.abs(sub_node.output(0))
1090
+ abs_diff = abs_diff_node.output(0)
1091
+
1092
+ # Compute negative absolute difference and its exponential
1093
+ neg_abs_diff_node = ov_opset.negative(abs_diff)
1094
+ neg_abs_diff = neg_abs_diff_node.output(0)
1095
+ exp_neg_abs_node = ov_opset.exp(neg_abs_diff)
1096
+ exp_neg_abs = exp_neg_abs_node.output(0)
1097
+
1098
+ # Get the element type from the node, not the output
1099
+ element_type = exp_neg_abs_node.get_element_type()
1100
+ one_node = ov_opset.constant(1, element_type)
1101
+ one = one_node.output(0)
1102
+
1103
+ # Compute log term
1104
+ one_plus_exp_node = ov_opset.add(one, exp_neg_abs)
1105
+ one_plus_exp = one_plus_exp_node.output(0)
1106
+ log_term_node = ov_opset.log(one_plus_exp)
1107
+ log_term = log_term_node.output(0)
1108
+
1109
+ # Final result
1110
+ result_node = ov_opset.add(max_val, log_term)
1111
+ result = result_node.output(0)
1112
+
1113
+ return OpenVINOKerasTensor(result)
1070
1114
 
1071
1115
 
1072
1116
  def logical_and(x1, x2):
@@ -145,12 +145,13 @@ class Concatenate(Merge):
145
145
  # Input is unmasked. Append all 1s to masks,
146
146
  masks.append(ops.ones_like(input_i, dtype="bool"))
147
147
  elif mask_i.ndim < input_i.ndim:
148
- # Mask is smaller than the input, expand it
149
- masks.append(
150
- ops.broadcast_to(
151
- ops.expand_dims(mask_i, axis=-1), ops.shape(input_i)
152
- )
148
+ # Broadcast mask shape to match in a way where we capture the
149
+ # input as a symbolic input in the op graph.
150
+ mask_i = ops.logical_or(
151
+ ops.expand_dims(mask_i, axis=-1),
152
+ ops.zeros_like(input_i, dtype="bool"),
153
153
  )
154
+ masks.append(mask_i)
154
155
  else:
155
156
  masks.append(mask_i)
156
157
  concatenated = ops.concatenate(masks, axis=self.axis)
@@ -26,9 +26,9 @@ class StringLookup(IndexLookup):
26
26
  tokens will be used to create the vocabulary and all others will be treated
27
27
  as out-of-vocabulary (OOV).
28
28
 
29
- There are two possible output modes for the layer.
30
- When `output_mode` is `"int"`,
31
- input strings are converted to their index in the vocabulary (an integer).
29
+ There are two possible output modes for the layer. When `output_mode` is
30
+ `"int"`, input strings are converted to their index in the vocabulary (an
31
+ integer).
32
32
  When `output_mode` is `"multi_hot"`, `"count"`, or `"tf_idf"`, input strings
33
33
  are encoded into an array where each dimension corresponds to an element in
34
34
  the vocabulary.
@@ -48,7 +48,7 @@ class StringLookup(IndexLookup):
48
48
  It can however be used with any backend when running eagerly.
49
49
  It can also always be used as part of an input preprocessing pipeline
50
50
  with any backend (outside the model itself), which is how we recommend
51
- to use this layer.
51
+ using this layer.
52
52
 
53
53
  **Note:** This layer is safe to use inside a `tf.data` pipeline
54
54
  (independently of which backend you're using).
@@ -65,28 +65,26 @@ class StringLookup(IndexLookup):
65
65
  If this value is 0, OOV inputs will cause an error when calling
66
66
  the layer. Defaults to `1`.
67
67
  mask_token: A token that represents masked inputs. When `output_mode` is
68
- `"int"`, the token is included in vocabulary and mapped to index 0.
69
- In other output modes, the token will not appear
70
- in the vocabulary and instances of the mask token
71
- in the input will be dropped. If set to `None`,
72
- no mask term will be added. Defaults to `None`.
68
+ `"int"`, the token is included in the vocabulary and mapped to index
69
+ 0.
70
+ In other output modes, the token will not appear in the vocabulary
71
+ and instances of the mask token in the input will be dropped.
72
+ If set to `None`, no mask term will be added. Defaults to `None`.
73
73
  oov_token: Only used when `invert` is True. The token to return for OOV
74
74
  indices. Defaults to `"[UNK]"`.
75
- vocabulary: Optional. Either an array of integers or a string path to a
76
- text file. If passing an array, can pass a tuple, list,
77
- 1D NumPy array, or 1D tensor containing the integer vocbulary terms.
78
- If passing a file path, the file should contain one line per term
79
- in the vocabulary. If this argument is set,
80
- there is no need to `adapt()` the layer.
81
- vocabulary_dtype: The dtype of the vocabulary terms, for example
82
- `"int64"` or `"int32"`. Defaults to `"int64"`.
75
+ vocabulary: Optional. Either an array of strings or a string path to a
76
+ text file. If passing an array, you can pass a tuple, list, 1D NumPy
77
+ array, or 1D tensor containing the string vocabulary terms.
78
+ If passing a file path, the file should contain one line per term in
79
+ the vocabulary. If this argument is set, there is no need to
80
+ `adapt()` the layer.
83
81
  idf_weights: Only valid when `output_mode` is `"tf_idf"`.
84
82
  A tuple, list, 1D NumPy array, or 1D tensor or the same length
85
83
  as the vocabulary, containing the floating point inverse document
86
84
  frequency weights, which will be multiplied by per sample term
87
85
  counts for the final TF-IDF weight.
88
- If the `vocabulary` argument is set, and `output_mode` is
89
- `"tf_idf"`, this argument must be supplied.
86
+ If the `vocabulary` argument is set and `output_mode` is `"tf_idf"`,
87
+ this argument must be supplied.
90
88
  invert: Only valid when `output_mode` is `"int"`.
91
89
  If `True`, this layer will map indices to vocabulary items
92
90
  instead of mapping vocabulary items to indices.
@@ -102,11 +100,11 @@ class StringLookup(IndexLookup):
102
100
  If the last dimension is not size 1, will append a new
103
101
  dimension for the encoded output.
104
102
  - `"multi_hot"`: Encodes each sample in the input into a single
105
- array the same size as the vocabulary,
106
- containing a 1 for each vocabulary term present in the sample.
107
- Treats the last dimension as the sample dimension,
108
- if input shape is `(..., sample_length)`,
109
- output shape will be `(..., num_tokens)`.
103
+ array the same size as the vocabulary containing a 1 for each
104
+ vocabulary term present in the sample.
105
+ Treats the last dimension as the sample dimension, if the input
106
+ shape is `(..., sample_length)`, the output shape will be
107
+ `(..., num_tokens)`.
110
108
  - `"count"`: As `"multi_hot"`, but the int array contains
111
109
  a count of the number of times the token at that index
112
110
  appeared in the sample.
@@ -240,8 +238,8 @@ class StringLookup(IndexLookup):
240
238
  array([[0. , 0.25, 0. , 0.6 , 0.8 ],
241
239
  [1.0 , 0. , 0.75, 0. , 0.4 ]], dtype=float32)
242
240
 
243
- To specify the idf weights for oov values, you will need to pass the entire
244
- vocabulary including the leading oov token.
241
+ To specify the idf weights for OOV values, you will need to pass the entire
242
+ vocabulary including the leading OOV token.
245
243
 
246
244
  >>> vocab = ["[UNK]", "a", "b", "c", "d"]
247
245
  >>> idf_weights = [0.9, 0.25, 0.75, 0.6, 0.4]
@@ -269,7 +267,7 @@ class StringLookup(IndexLookup):
269
267
  array([[b'a', b'c', b'd'],
270
268
  [b'd', b'[UNK]', b'b']], dtype=object)
271
269
 
272
- Note that the first index correspond to the oov token by default.
270
+ Note that the first index corresponds to the OOV token by default.
273
271
 
274
272
 
275
273
  **Forward and inverse lookup pairs**
@@ -340,7 +338,7 @@ class StringLookup(IndexLookup):
340
338
  self.supports_jit = False
341
339
 
342
340
  def adapt(self, data, steps=None):
343
- """Computes a vocabulary of integer terms from tokens in a dataset.
341
+ """Computes a vocabulary of terms from tokens in a dataset.
344
342
 
345
343
  Calling `adapt()` on a `StringLookup` layer is an alternative to passing
346
344
  in a precomputed vocabulary on construction via the `vocabulary`
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.12.0.dev2025090603"
4
+ __version__ = "3.12.0.dev2025090903"
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.12.0.dev2025090603
3
+ Version: 3.12.0.dev2025090903
4
4
  Summary: Multi-backend Keras
5
5
  Author-email: Keras team <keras-users@googlegroups.com>
6
6
  License: Apache License 2.0
@@ -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=ELthL9eucLtJhRxWi9NzOJq40f7oHEyHG97k0pbAHno,204
129
+ keras/src/version.py,sha256=gCJ4yVS06N9oTZLV65H3WwJsyvryzNGeuXaPVf5fZ1k,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
@@ -196,7 +196,7 @@ keras/src/backend/openvino/layer.py,sha256=5RdvaH1yOyPAphjKiuQAK1H_yZFYKE1Hp7c5b
196
196
  keras/src/backend/openvino/linalg.py,sha256=Q09iv7fcE-xtNOop_hTG_RADkI0CHhjfrcOHqdWCmIY,1486
197
197
  keras/src/backend/openvino/math.py,sha256=qw9kX2sJ2qr0dBJF12Ey0E2GcwixPUqoev6UcNra4NI,3944
198
198
  keras/src/backend/openvino/nn.py,sha256=FUjNvBOcwP-A1BHffaCIZ-bl6na6xM_v91dcaTP4Q4U,15121
199
- keras/src/backend/openvino/numpy.py,sha256=LmVuPzBjgYZ9RAuw2JeRfKcaLJSw-BOADXfvszC2F8w,65812
199
+ keras/src/backend/openvino/numpy.py,sha256=V5Q_e909hfjT4lyu1DkBRAdVkPiN_lfRad8oQ8xQ44Y,67475
200
200
  keras/src/backend/openvino/random.py,sha256=bR7BYdfYHsBi5rYgCKmpFf310fa1q7JT48Z29XxhwmA,5851
201
201
  keras/src/backend/openvino/rnn.py,sha256=ErmuZLPSgG9qU-NfYPPvBZ6Ysy8k-fA4g19Vhqq7OVQ,866
202
202
  keras/src/backend/openvino/trainer.py,sha256=bMmtSALqydqdS6ke-5sYW5fgxZDshDH810p_C0xCRTg,9087
@@ -329,7 +329,7 @@ keras/src/layers/merging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
329
329
  keras/src/layers/merging/add.py,sha256=icbh3RwZ3QUP3bFNCi7GbrHj2hFdKu1Dsv8djSa13co,2150
330
330
  keras/src/layers/merging/average.py,sha256=RPW8Lpj0U3ebMdvhyI451Iw_Qn7p6tKAEgdgDds19Co,2214
331
331
  keras/src/layers/merging/base_merge.py,sha256=vzMNOBvb52olyXhMMAVfWJBJSdieZSN5HuC6MwwZGUg,10774
332
- keras/src/layers/merging/concatenate.py,sha256=KnYuGiJnc_cmsm-GaZIclh93_S2l_jOvOCW0s2SvAlk,6772
332
+ keras/src/layers/merging/concatenate.py,sha256=kbJbZW7DI2R_SPsze1l4UGVuxG08XXSXu_AQhBlIC74,6875
333
333
  keras/src/layers/merging/dot.py,sha256=xuZ1WRt-kWJl08V0-O7idhzq9LXZx4xWRYeoWNlxnko,12781
334
334
  keras/src/layers/merging/maximum.py,sha256=5lF8X0raVikM8YimdXJlZlbwT6-BGFD3O61sDsPidcw,2142
335
335
  keras/src/layers/merging/minimum.py,sha256=f8RN1O5yYzDqJbXuVTBKC0TKdEw_VU4bC4pZX2zE35A,2140
@@ -371,7 +371,7 @@ keras/src/layers/preprocessing/normalization.py,sha256=DKXPEfWZNDVabReyIayMlzsis
371
371
  keras/src/layers/preprocessing/pipeline.py,sha256=D6dd1LQTW9m9jUaeorTn29rY19gRmkSXXaUxj02kUxc,2533
372
372
  keras/src/layers/preprocessing/rescaling.py,sha256=Uhcqui6BKs9DI-iJYItWSWA6AH1mmBrDH1N4Daz68P0,2802
373
373
  keras/src/layers/preprocessing/stft_spectrogram.py,sha256=D92Gsbx4chANl2xLPXBCSKTM6z3Nc9pWZpgTz0d5MnA,15058
374
- keras/src/layers/preprocessing/string_lookup.py,sha256=SkJyJrCbopO4BbAqcvBm-AUiNrNXoxNRMGZOHv8q2R4,18622
374
+ keras/src/layers/preprocessing/string_lookup.py,sha256=OIkPV7DZbX8rMf2J95bPBoFcaxso7_1yDnpjBJFIZ4M,18495
375
375
  keras/src/layers/preprocessing/text_vectorization.py,sha256=p1uubjplFyPo5yOnNJXtG9Vg0GJMQTJucUGljf3FROM,28161
376
376
  keras/src/layers/preprocessing/image_preprocessing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
377
377
  keras/src/layers/preprocessing/image_preprocessing/aug_mix.py,sha256=74a--OGdbonqwdEpErAZ8EnS6aGNyktRcPYheTvTbvg,11221
@@ -596,7 +596,7 @@ keras/utils/bounding_boxes/__init__.py,sha256=jtvQll4u8ZY0Z96HwNhP1nxWEG9FM3gI-6
596
596
  keras/utils/legacy/__init__.py,sha256=oSYZz6uS8UxSElRaaJYWJEoweJ4GAasZjnn7fNaOlog,342
597
597
  keras/visualization/__init__.py,sha256=UKWmiy6sps4SWlmQi9WX8_Z53cPpLlphz2zIeHdwJpQ,722
598
598
  keras/wrappers/__init__.py,sha256=QkS-O5K8qGS7C3sytF8MpmO6PasATpNVGF8qtb7Ojsw,407
599
- keras_nightly-3.12.0.dev2025090603.dist-info/METADATA,sha256=LGZ5_VYCdAQYjKxL2Rl30PCxugeHn1nF_bbmSX5xvGE,5970
600
- keras_nightly-3.12.0.dev2025090603.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
601
- keras_nightly-3.12.0.dev2025090603.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
602
- keras_nightly-3.12.0.dev2025090603.dist-info/RECORD,,
599
+ keras_nightly-3.12.0.dev2025090903.dist-info/METADATA,sha256=JSQH1WnxunypW2EmbKI4P2FYYD-TQee-dvbTy4GSntw,5970
600
+ keras_nightly-3.12.0.dev2025090903.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
601
+ keras_nightly-3.12.0.dev2025090903.dist-info/top_level.txt,sha256=ptcw_-QuGZ4ZDjMdwi_Z0clZm8QAqFdvzzFnDEOTs9o,6
602
+ keras_nightly-3.12.0.dev2025090903.dist-info/RECORD,,