test(linalg): Add more tests for compute_gramian#541
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
|
Will Github ever provide a good LaTeX interpreter? A Jacobian in this yields |
compute_gramian
|
Thanks for explaining, that makes more sense to me now!
I think you meant |
Apparently there's no double-dollar formulas, and \begin{bmatrix} doesn't work with inline (single-dollar) formulas. Also, sometimes, single-dollar formulas do not work for no reason it seems. However, you can use ```math For example: I edited your comment for proper formatting. |
|
I think I was also quite confused by how Example (from their documentation): a = torch.randn(3, 4, 5)
b = torch.randn(4, 5, 6)
c = torch.tensordot(a, b, dims=2)
tensor([[ 8.3504, -2.5436, 6.2922, 2.7556, -1.0732, 3.2741],
[ 3.3161, 0.0704, 5.0187, -0.4079, -4.3126, 4.8744],
[ 0.8223, 3.9445, 3.2168, -0.2400, 3.4117, 1.7780]])I would have expected the correct way to do this to be: a = torch.randn(3, 4, 5)
b = torch.randn(5, 4, 6) # 4 and 5 swapped here
c = torch.tensordot(a, b, dims=2)
tensor([[ 8.3504, -2.5436, 6.2922, 2.7556, -1.0732, 3.2741],
[ 3.3161, 0.0704, 5.0187, -0.4079, -4.3126, 4.8744],
[ 0.8223, 3.9445, 3.2168, -0.2400, 3.4117, 1.7780]])But this is the whole reason why we implemented |
We have a problem in
test_compute_gramian_matrix_input_2. It's basically computingtensordot(t, t, dims=2)instead oftensordot(t, t.T, dims=2). I think there is an error in the logic ofcompute_gramianin:=> This gives
indices_source=[]andindices_dest=[]for the example oftest_compute_gramian_matrix_input_2(matrix input, 2 contracted dims) => No transposition.