Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix svd jvp rule for compute_uv == False.
  • Loading branch information
bchetioui committed Aug 4, 2020
commit 01ae3a0f73ff4459c9e35925abd6ea46775cd013
3 changes: 3 additions & 0 deletions jax/lax_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,9 @@ def svd_jvp_rule(primals, tangents, full_matrices, compute_uv):
dU = jnp.matmul(U, F * (dSS + _T(dSS)))
dV = jnp.matmul(V, F * (SdS + _T(SdS)))

if not compute_uv:
return (s,), (ds,)

m, n = A.shape[-2:]
if m > n:
dU = dU + jnp.matmul(jnp.eye(m, dtype=A.dtype) - jnp.matmul(U, Ut), jnp.matmul(dA, V)) / s_dim
Expand Down