Skip to content

Fix message formatting #21241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keras/src/backend/tensorflow/nn.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def depthwise_conv(
if num_spatial_dims > 2:
raise ValueError(
"`inputs` rank must be 3 (1D conv) or 4 (2D conv). Received: "
"{inputs.ndim}."
f"{inputs.ndim}."
)
# Because we use `tf.nn.depthwise_conv2d` for both 1D and 2D convs, we set
# `tf_data_format` using 2D conv format.
Expand Down
2 changes: 1 addition & 1 deletion keras/src/backend/tensorflow/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1999,7 +1999,7 @@ def unravel_index(x, shape):

if None in shape:
raise ValueError(
"`shape` argument cannot contain `None`. Received: shape={shape}"
f"`shape` argument cannot contain `None`. Received: shape={shape}"
)

if x.ndim == 1:
Expand Down
3 changes: 2 additions & 1 deletion keras/src/layers/attention/grouped_query_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ def compute_output_shape(
raise ValueError(
"The last dimension of `query_shape` and `value_shape` "
f"must be equal, but are {query_shape[-1]}, {value_shape[-1]}. "
"Received: query_shape={query_shape}, value_shape={value_shape}"
f"Received: query_shape={query_shape}, "
f"value_shape={value_shape}"
)

if value_shape[1:-1] != key_shape[1:-1]:
Expand Down
2 changes: 1 addition & 1 deletion keras/src/layers/core/lambda_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def _serialize_function_to_config(self, fn):
def _raise_for_lambda_deserialization(arg_name, safe_mode):
if safe_mode:
raise ValueError(
"The `{arg_name}` of this `Lambda` layer is a Python lambda. "
f"The `{arg_name}` of this `Lambda` layer is a Python lambda. "
"Deserializing it is unsafe. If you trust the source of the "
"config artifact, you can override this error "
"by passing `safe_mode=False` "
Expand Down
2 changes: 1 addition & 1 deletion keras/src/layers/preprocessing/category_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def call(self, inputs, count_weights=None):
if self.output_mode != "count":
raise ValueError(
"`count_weights` is not used when `output_mode` is not "
"`'count'`. Received `count_weights={count_weights}`."
f"`'count'`. Received `count_weights={count_weights}`."
)
count_weights = self.backend.convert_to_tensor(
count_weights, dtype=self.compute_dtype
Expand Down
4 changes: 2 additions & 2 deletions keras/src/ops/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def _assert_1d(*arrays):
for a in arrays:
if a.ndim < 1:
raise ValueError(
"Expected input to have rank >= 1. Received scalar input {a}."
f"Expected input to have rank >= 1. Received scalar input {a}."
)


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


Expand Down
2 changes: 1 addition & 1 deletion keras/src/ops/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ def compute_output_spec(self, x):
if len(x_shape) < 2:
raise ValueError(
"`diagonal` requires an array of at least two dimensions, but "
"`x` is of shape {x.shape}."
f"`x` is of shape {x.shape}."
)

shape_2d = [x_shape[self.axis1], x_shape[self.axis2]]
Expand Down
2 changes: 1 addition & 1 deletion keras/src/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ def _rescale_dataset_split_sizes(left_size, right_size, total_length):
if left_size + right_size > total_length:
raise ValueError(
"The sum of `left_size` and `right_size` should "
"be smaller than the {total_length}. "
f"be smaller than the {total_length}. "
f"Received: left_size + right_size = {left_size + right_size}"
f"and total_length = {total_length}"
)
Expand Down