You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I was trying to use the function tt_reshape, I encountered the following problem:
It works when the code is :
tt_reshape(tt_eye(8),[2,2,2;2,2,2]')
but if I change the size:
tt_reshape(tt_eye(8),[4,4,4;1,1,1]')
it went wrong.
and if I change the size to:
tt_reshape(tt_eye(8),[4,1,4;1,4,1]')
it worked again!
I wonder what is the reason and what should I pay attention to when reshaping a TT tensor/matrix?
Maybe this is a simple question, but I really can't find the answer. Sincerely hope someone can help me answer
The text was updated successfully, but these errors were encountered:
Actually, I don't know how to reshape a tt_matrix. tt_tensor is easy: split a core of required size if you can, otherwise merge original cores until you can. For tt_matrix, you need to permute dimensions in different ways depending on what you want (you can't even tell this from sizes alone).
In your example in particular, splitting out a 4 x 1 core from a 8 x 8 matrix can be understood in at least the following ways:
consider the matrix as tt_eye(2,3), and reshape each core into a 4 x 1 matrix (perhaps what you want);
split the original full matrix into 4 x 2 x 1 x 8;
split the original full matrix into 4 x 1 x ...
(the total number of ways is combinatorial I think).
The current code works if both row and column sizes can be reorganized by the same sequence of splits and merges. For anything more general I don't see how to write it consistently.
When I was trying to use the function tt_reshape, I encountered the following problem:
It works when the code is :
but if I change the size:
tt_reshape(tt_eye(8),[4,4,4;1,1,1]')
it went wrong.
and if I change the size to:
tt_reshape(tt_eye(8),[4,1,4;1,4,1]')
it worked again!
I wonder what is the reason and what should I pay attention to when reshaping a TT tensor/matrix?
Maybe this is a simple question, but I really can't find the answer. Sincerely hope someone can help me answer
The text was updated successfully, but these errors were encountered: