Skip to content

Commit b9a49ea

Browse files
authoredFeb 8, 2025··
fix solve method on linalg (#20879)
1 parent 084ac36 commit b9a49ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎keras/src/backend/tensorflow/linalg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def qr(x, mode="reduced"):
169169

170170
def solve(a, b):
171171
# tensorflow.linalg.solve only supports same rank inputs
172-
if tf.rank(b) == tf.rank(a) - 1:
172+
if b.shape.ndims == a.shape.ndims - 1:
173173
b = tf.expand_dims(b, axis=-1)
174174
return tf.squeeze(tf.linalg.solve(a, b), axis=-1)
175175
return tf.linalg.solve(a, b)

0 commit comments

Comments
 (0)
Please sign in to comment.