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

[BUG] Cannot factorize with repeated tensors in expression #246

Open
yhtang opened this issue Sep 15, 2022 · 0 comments
Open

[BUG] Cannot factorize with repeated tensors in expression #246

yhtang opened this issue Sep 15, 2022 · 0 comments
Assignees
Labels
bug Something isn't working priority

Comments

@yhtang
Copy link
Owner

yhtang commented Sep 15, 2022

Describe the bug
If the same tensor shows up more than once in a tensor expression, then it cannot be correctly factorized. Related to #210, #228, #232.

To Reproduce

n = 2
V = ff.tensor('V', n, n)
i, j, k = ff.indices('i, j, k')
tsrex_eigh = V[i, j] * V[j, k]
fac = ff.factorize(
    tsrex_eigh,
    np.eye(n, dtype=np.float32)
)

gets

> fac()
tensor([[ 0.0072,  0.0116],
        [-0.0031,  0.0020]], grad_fn=<ViewBackward>)

> fac.tsrex.asciitree('data')
 ein: sum:multiply 
 ├── indexed_tensor: [i,j] 
 │   ├── tensor: V (data: tensor([[ 1.0021,  0.0717],        [-0.0569, -1.0022]])) 
 │   ╰── indices: i,j 
 │       ├── index: i 
 │       ╰── index: j 
 ╰── indexed_tensor: [j,k] 
     ├── tensor: V (data: tensor([[ 0.0070,  0.0118],        [ 0.0027, -0.0027]], requires_grad=True)) 
     ╰── indices: j,k 
         ├── index: j 
         ╰── index: k 

Expected behavior
A trivial solution should be found easily.

@yhtang yhtang added bug Something isn't working priority labels Sep 15, 2022
@yhtang yhtang self-assigned this Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority
Projects
None yet
Development

No branches or pull requests

1 participant