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

Infinite loop within tensor cross #463

Open
ryanlevy opened this issue Nov 30, 2022 · 3 comments
Open

Infinite loop within tensor cross #463

ryanlevy opened this issue Nov 30, 2022 · 3 comments
Labels

Comments

@ryanlevy
Copy link

Describe the bug

For certain rank inputs to tensor_train_cross the algorithm gets stuck in a while loop.

Steps or Code to Reproduce

import numpy as np
import tensorly as tl
from tensorly.contrib.decomposition import tensor_train_cross

tensor = tl.tensor(np.arange(2**6).reshape(2,2,2,2,2,2))
factors = tensor_train_cross(tensor, [1,3,3,3,3,3,1])
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
...
File /home/rlevy/venvs/tensors/lib/python3.9/site-packages/tensorly/contrib/decomposition/_tt_cross.py:127, in <listcomp>(.0)
    125         newidx = tuple([rng.randint(tensor_shape[j]) for j in range(k_col_idx + 1, tensor_order)])
    126         while newidx in col_idx[k_col_idx]:
--> 127             newidx = tuple([rng.randint(tensor_shape[j]) for j in range(k_col_idx + 1, tensor_order)])
    129         col_idx[k_col_idx].append(newidx)
    131 # Initialize the cores of tensor-train

Versions

Linux-4.18.0-372.19.1.el8_6.x86_64-x86_64-with-glibc2.28
Python 3.9.12 (main, Jun 16 2022, 18:08:55) 
[GCC 10.3.0]
NumPy 1.21.6
SciPy 1.8.0
TensorLy 0.7.0
@aarmey aarmey added bug easy issue Easy issue, good for first contribution. and removed easy issue Easy issue, good for first contribution. labels Jan 17, 2023
@meandmytram
Copy link

meandmytram commented Oct 20, 2023

Second the bug!

@JeanKossaifi
Copy link
Member

Thanks for reporting @meandmytram @ryanlevy! Would you be able to open a small PR to fix the issue?

@meandmytram
Copy link

Hey @JeanKossaifi, thanks for a quick response! While normally I'd be willing to help, now I'm super busy so I'm afraid I simply won't have enough time to dig in the source code of the algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants