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

tt.optimize.tt_min.min_tens does not work #91

Open
tzoiker opened this issue Mar 27, 2022 · 0 comments
Open

tt.optimize.tt_min.min_tens does not work #91

tzoiker opened this issue Mar 27, 2022 · 0 comments

Comments

@tzoiker
Copy link

tzoiker commented Mar 27, 2022

tt.optimize.tt_min.min_tens does not work at least for ttpy==1.2.1

How to reproduce: example

import tt
from tt.optimize import tt_min
tens = tt.rand([3, 4, 5, 4, 3], 5, 3)
min_element = min(tens.full().flatten())
print("Minimize random 5-dimensional TT tensor with ranks equal to 3. " +
      "The minimal element is %f" % min_element)
val, point = tt_min.min_tens(tens, rmax=10, nswp=30)

Gives the following error:

Minimize random 5-dimensional TT tensor with ranks equal to 3. The minimal element is -15.459226
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_23243/3135023836.py in <module>
      5 print("Minimize random 5-dimensional TT tensor with ranks equal to 3. " +
      6       "The minimal element is %f" % min_element)
----> 7 val, point = tt_min.min_tens(tens, rmax=10, nswp=30)

~/storage/miniconda2/envs/cqfs/lib/python3.7/site-packages/tt/optimize/tt_min.py in min_tens(tens, rmax, nswp, verb, smooth_fun)
    214             lm = min_cur
    215             x_full = J[ind_cur, :]
--> 216             val = tens[x_full]
    217             if verb:
    218                 print('New record:', val, 'Point:', x_full, 'elements seen:', elements_seen)

~/storage/miniconda2/envs/cqfs/lib/python3.7/site-packages/tt/core/vector.py in __getitem__(self, index)
    173                 (self.r[i], self.n[i], self.r[i + 1]), order='F')
    174             cur_core = cur_core[
--> 175                 :, index[i], :].reshape(
    176                 (self.r[i], -1), order='F')
    177             if running_fact is None:

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
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

No branches or pull requests

1 participant