Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to TensorKind.SPARSE_COO for sparse tensors #181

Merged
merged 2 commits into from Aug 24, 2022

Conversation

gsakkis
Copy link
Contributor

@gsakkis gsakkis commented Aug 23, 2022

Currently we default to TensorKind.SPARSE_CSR for 2D sparse arrays on Pytorch, However the CSR sparse tensor format:

  • is not implemented for Tensorflow
  • is in beta state for Pytorch even on the latest version (1.12) and triggers UserWarning: Sparse CSR tensor support is in beta state. If you miss a functionality in the sparse tensor support, please submit a feature request to https://github.com/pytorch/pytorch/issues

This small PR changes the default sparse tensor kind to be always TensorKind.SPARSE_COO for both Pytorch and Tensorflow, regardless of the array shape. The user can still select CSR tensors by passing explicitly tensor_kind=TensorKind.SPARSE_CSR to ArrayParams.

@gsakkis
Copy link
Contributor Author

gsakkis commented Aug 24, 2022

Added a second commit that was enabled by the first: simplify ArrayParams.to_tensor_schema() by removing the framework-specific tensor transformation logic.

@gsakkis gsakkis requested a review from ktsitsi August 24, 2022 08:06
@gsakkis gsakkis merged commit ebef05c into master Aug 24, 2022
@gsakkis gsakkis deleted the gsa/default_sparse_coo branch August 24, 2022 11:54
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.

None yet

2 participants