Skip to content

SVD operation failed when compute_uv=False (TF backend) #20094

@cofri

Description

@cofri

Problem raised

TensorFlow tf.linalg.svd() with compute_uv=False returns a single tensor containing the singular values, and not three tensors "s, u, v" when compute_uv=True.
However, code line 188 in keras/src/backend/tensorflow/linalg.py always expects three returned tensors, even if only one is expected when compute_uv=False. It raises a ValueError: not enough values to unpack.

s, u, v = tf.linalg.svd(
)

Tested versions:

  • Keras 3.4.1
  • TensorFlow 2.17.0

Code to reproduce:

import keras
keras.ops.svd([[1.0, 0.0], [2.0, 0.0]], compute_uv=False)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions