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

More descriptive message when random PARAFAC2 rank is infeasible given shape #528

Open
Mr-Niraj-Kulkarni opened this issue Sep 15, 2023 · 1 comment

Comments

@Mr-Niraj-Kulkarni
Copy link

Mr-Niraj-Kulkarni commented Sep 15, 2023

Describe the bug

When Testing the random parafrac2 function fails throwing a error " ValueError: All the projection matrices of a PARAFAC2 tensor should have the same number of columns as the rank. However, rank=2 but projections[0].shape[1]=1" while validating when parafrac2Tensor object is being created by projection_matrices, weights and factors.

Steps or Code to Reproduce

For instance:
Arguments passed to random Tensor are
shapes = [(1, 1), (1, 1)]
rank =2

Expected behavior

projection shape should have the same rank as rank passed both 2

Actual result

But getting projection rank as 1 and actual rank is 2
Please paste or specifically describe the actual output or traceback.

for i, projection in enumerate(projections):
            current_mode_size, current_rank = ivy.shape(projection)
            if current_rank != rank:
>               raise ValueError(
                    "All the projection matrices of a PARAFAC2 tensor should have the"
                    f" same number of columns as the rank. However, rank={rank} but"
                    f" projections[{i}].shape[1]={ivy.shape(projection)[1]}"
                )
E               ValueError: All the projection matrices of a PARAFAC2 tensor should have the same number of columns as the rank. However, rank=2 but projections[0].shape[1]=1

ivy/data_classes/factorized_tensor/parafac2_tensor.py:166: ValueError

Versions

@aarmey
Copy link
Contributor

aarmey commented Sep 19, 2023

Thanks for the issue, @Mr-Niraj-Kulkarni. Does this ever happen with datasets of larger sizes? The rank cannot be larger than max(X.shape). We can certainly add a more descriptive error message for this situation.

@aarmey aarmey changed the title Random Parafrac2 method projection_matrices failure More descriptive message when random PARAFAC2 rank is infeasible given shape Sep 27, 2023
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

2 participants