From 4ba7d6f0b70e90c0270f9e86fccbb2f30d8a0647 Mon Sep 17 00:00:00 2001 From: Jeff Carpenter Date: Mon, 28 Oct 2024 16:23:27 -0700 Subject: [PATCH] Fix additional shape comparison for TF1 compatibility (#20422) I missed this in #20413. Confirmed this fixes the issue in Colab. --- keras/src/backend/tensorflow/numpy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keras/src/backend/tensorflow/numpy.py b/keras/src/backend/tensorflow/numpy.py index b59ee2a4415..bc97e6cd98e 100644 --- a/keras/src/backend/tensorflow/numpy.py +++ b/keras/src/backend/tensorflow/numpy.py @@ -39,7 +39,7 @@ def add(x1, x2): # Special case of `tf.add`: `tf.nn.bias_add` # `BiasAdd` can be fused with `MatMul` and `Conv*` kernels # Expecting `x1` to be `inputs` and `x2` to be `bias` (no swapping) - x2_squeeze_shape = [d for d in x2.shape if d is None or d > 1] + x2_squeeze_shape = [d for d in x2.shape.as_list() if d is None or d > 1] if ( # `x2` looks like bias (can be squeezed to vector) 1 == len(x2_squeeze_shape)