From 23d5eebd5c1641d9fafbe68985c462f3abc3f2a9 Mon Sep 17 00:00:00 2001 From: Muhammad Anas Raza <63569834+anas-rz@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:59:03 -0500 Subject: [PATCH] raise exception on unknown padding for conv (#19057) --- keras/ops/operation_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keras/ops/operation_utils.py b/keras/ops/operation_utils.py index 8869c988b9b..277a70cb1a4 100644 --- a/keras/ops/operation_utils.py +++ b/keras/ops/operation_utils.py @@ -219,6 +219,11 @@ def compute_conv_output_shape( ) elif padding == "same" or padding == "causal": output_spatial_shape = np.floor((spatial_shape - 1) / strides) + 1 + else: + raise ValueError( + "`padding` must be either `'valid'` or `'same'`. Received " + f"{padding}." + ) output_spatial_shape = [int(i) for i in output_spatial_shape] for i in none_dims: output_spatial_shape[i] = None