Skip to content

Commit 4c6b7e3

Browse files
Fix message formatting (#21241)
* Fix message formatting Signed-off-by: Emmanuel Ferdman <[email protected]> * Fix message formatting Signed-off-by: Emmanuel Ferdman <[email protected]> --------- Signed-off-by: Emmanuel Ferdman <[email protected]>
1 parent 48a6692 commit 4c6b7e3

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

keras/src/backend/tensorflow/nn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def depthwise_conv(
353353
if num_spatial_dims > 2:
354354
raise ValueError(
355355
"`inputs` rank must be 3 (1D conv) or 4 (2D conv). Received: "
356-
"{inputs.ndim}."
356+
f"{inputs.ndim}."
357357
)
358358
# Because we use `tf.nn.depthwise_conv2d` for both 1D and 2D convs, we set
359359
# `tf_data_format` using 2D conv format.

keras/src/backend/tensorflow/numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ def unravel_index(x, shape):
19991999

20002000
if None in shape:
20012001
raise ValueError(
2002-
"`shape` argument cannot contain `None`. Received: shape={shape}"
2002+
f"`shape` argument cannot contain `None`. Received: shape={shape}"
20032003
)
20042004

20052005
if x.ndim == 1:

keras/src/layers/attention/grouped_query_attention.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,8 @@ def compute_output_shape(
464464
raise ValueError(
465465
"The last dimension of `query_shape` and `value_shape` "
466466
f"must be equal, but are {query_shape[-1]}, {value_shape[-1]}. "
467-
"Received: query_shape={query_shape}, value_shape={value_shape}"
467+
f"Received: query_shape={query_shape}, "
468+
f"value_shape={value_shape}"
468469
)
469470

470471
if value_shape[1:-1] != key_shape[1:-1]:

keras/src/layers/core/lambda_layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _serialize_function_to_config(self, fn):
170170
def _raise_for_lambda_deserialization(arg_name, safe_mode):
171171
if safe_mode:
172172
raise ValueError(
173-
"The `{arg_name}` of this `Lambda` layer is a Python lambda. "
173+
f"The `{arg_name}` of this `Lambda` layer is a Python lambda. "
174174
"Deserializing it is unsafe. If you trust the source of the "
175175
"config artifact, you can override this error "
176176
"by passing `safe_mode=False` "

keras/src/layers/preprocessing/category_encoding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def call(self, inputs, count_weights=None):
157157
if self.output_mode != "count":
158158
raise ValueError(
159159
"`count_weights` is not used when `output_mode` is not "
160-
"`'count'`. Received `count_weights={count_weights}`."
160+
f"`'count'`. Received `count_weights={count_weights}`."
161161
)
162162
count_weights = self.backend.convert_to_tensor(
163163
count_weights, dtype=self.compute_dtype

keras/src/ops/linalg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def _assert_1d(*arrays):
665665
for a in arrays:
666666
if a.ndim < 1:
667667
raise ValueError(
668-
"Expected input to have rank >= 1. Received scalar input {a}."
668+
f"Expected input to have rank >= 1. Received scalar input {a}."
669669
)
670670

671671

@@ -674,7 +674,7 @@ def _assert_2d(*arrays):
674674
if a.ndim < 2:
675675
raise ValueError(
676676
"Expected input to have rank >= 2. "
677-
"Received input with shape {a.shape}."
677+
f"Received input with shape {a.shape}."
678678
)
679679

680680

keras/src/ops/numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ def compute_output_spec(self, x):
22832283
if len(x_shape) < 2:
22842284
raise ValueError(
22852285
"`diagonal` requires an array of at least two dimensions, but "
2286-
"`x` is of shape {x.shape}."
2286+
f"`x` is of shape {x.shape}."
22872287
)
22882288

22892289
shape_2d = [x_shape[self.axis1], x_shape[self.axis2]]

keras/src/utils/dataset_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def _rescale_dataset_split_sizes(left_size, right_size, total_length):
406406
if left_size + right_size > total_length:
407407
raise ValueError(
408408
"The sum of `left_size` and `right_size` should "
409-
"be smaller than the {total_length}. "
409+
f"be smaller than the {total_length}. "
410410
f"Received: left_size + right_size = {left_size + right_size}"
411411
f"and total_length = {total_length}"
412412
)

0 commit comments

Comments
 (0)