-
Hello JAX team: Here's the code to reproduce:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
I believe that the difference here is that the dense JVP is perturbing every element of the array, while the sparse JVP is perturbing only defined elements in the array. In your example, This is by design: otherwise, taking the grad of a sparse matrix would require instantiating a dense matrix of the same size, which is problematic in many applications. |
Beta Was this translation helpful? Give feedback.
-
@DoTulip , Did you figure out how to do a
|
Beta Was this translation helpful? Give feedback.
I believe that the difference here is that the dense JVP is perturbing every element of the array, while the sparse JVP is perturbing only defined elements in the array. In your example,
mA_dot
has 16 elements for the dense version, and 4 elements for the sparse version. When you eventually sum those, the results will be different.This is by design: otherwise, taking the grad of a sparse matrix would require instantiating a dense matrix of the same size, which is problematic in many applications.