How to handle errors caused by non-JAX objects (such as scipy.sparse.csr_matrix) in JAX custom_vjp?
I am using JAX to implement custom backpropagation (custom_vjp), but in my function, one of the input parameters is a sparse matrix of type scipy.sparse.csr_matrix. Since JAX expects all parameters to support JAX numerical operations (i.e. have a dtype attribute), my code will report an error during forward propagation, saying that JAX cannot handle scipy.sparse.csr_matrix.