We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Creating a sparse tensor using the sparse backend. Works as expected with unfold, and with partial_unfold.
import numpy as np import sparse from tensorly.contrib.sparse import tensor, unfold from tensorly.base import partial_unfold
X = sparse.COO(np.arange(1152).reshape((24,3,2,8))) X = sparse.COO(X.coords, X.data, shape=(100, 100, 100, 100)) X = tensor(X, dtype='float') print(unfold(X, 2)) # mode-1 unfolding, from tensorly.contrib.sparse print(partial_unfold(X,0,1,0))
output: <COO: shape=(100, 1000000), dtype=float64, nnz=1151, fill_value=0.0> <COO: shape=(100, 100, 10000), dtype=float64, nnz=1151, fill_value=0.0>
Linux-5.19.0-46-generic-x86_64-with-glibc2.35Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] NumPy 1.24.4 SciPy 1.11.1 TensorLy 0.8.1
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Creating a sparse tensor using the sparse backend. Works as expected with unfold, and with partial_unfold.
import numpy as np
import sparse
from tensorly.contrib.sparse import tensor, unfold
from tensorly.base import partial_unfold
X = sparse.COO(np.arange(1152).reshape((24,3,2,8)))
X = sparse.COO(X.coords, X.data, shape=(100, 100, 100, 100))
X = tensor(X, dtype='float')
print(unfold(X, 2)) # mode-1 unfolding, from tensorly.contrib.sparse
print(partial_unfold(X,0,1,0))
output:
<COO: shape=(100, 1000000), dtype=float64, nnz=1151, fill_value=0.0>
<COO: shape=(100, 100, 10000), dtype=float64, nnz=1151, fill_value=0.0>
Linux-5.19.0-46-generic-x86_64-with-glibc2.35Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
NumPy 1.24.4
SciPy 1.11.1
TensorLy 0.8.1
The text was updated successfully, but these errors were encountered: