Skip to content

Commit bb329d5

Browse files
committed
Improve exception handling in tile() to use specific exceptions
Signed-off-by: Samaresh Kumar Singh <[email protected]>
1 parent 7cf0da7 commit bb329d5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

keras/src/backend/tensorflow/numpy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,8 +2773,7 @@ def tile(x, repeats):
27732773
x_shape_list = [1] * (len(repeats) - x_rank) + [d if d is not None else -1 for d in x.shape.as_list()]
27742774
x = tf.reshape(x, x_shape_list)
27752775
return tf.tile(x, repeats)
2776-
except Exception:
2777-
# If anything goes wrong, fall back to original implementation
2776+
except (AttributeError, TypeError, tf.errors.OperatorNotAllowedInGraphError):
27782777
pass
27792778

27802779
# Original dynamic implementation for non-concrete repeats

0 commit comments

Comments
 (0)