Skip to content

Conversation

jeertmans
Copy link

Hi! I'm not sure if this is intended, but using get_shape only works for csc_matrix, but not csc_array, which raises an error when passing a sparse array as input. I encountered this bug when using the CVXPYLayers, and I could not find any issue related to this error (i.e., the fact that csc_array doesn't have a get_shape method).

If you intend to support both csc_matrix and csc_array, then using .shape works like a charm.
Otherwise, I think it would be good to add another check before, as csc_array.to_csc() returns a csc_array, and not a csc_matrix as expected by the if guard.

Hi! I'm not sure if this is intended, but using `get_shape` only works for [`csc_matrix`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csc_matrix.html), but not [`csc_array`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csc_array.html), which raises an error when passing a sparse array as input. I encountered this bug when using the CVXPYLayers, and I could not find any issue related to this error (i.e., the fact that `csc_array` doesn't have a `get_shape` method).

If you intend to support both `csc_matrix` and `csc_array`, then using `.shape` works like a charm.
 Otherwise, I think it would be good to add another check before, as `csc_array.to_csc()` returns a `csc_array`, and not a `csc_matrix` as expected by the `if` guard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant