One question
spicywei opened this issue · comments
Good choice! The updates to start
and end
are likely to cause this problem.
In our setting, the merged tensor is represented by a list of consecutive tensors. The index of the leftmost tensor is recorded in start
. The index of the rightmost tensor is recorded in 'end'.
-
Consider the following case, tensor 0 and tensor 1 are contracted. After the contraction, tensor 0 and tensor 1 are merged into a new tensor
$0 \rightarrow 1$ . To record which tensors are merged, we record the leftmost tensor, tensor 0, in thestart
, and record the rightmost tensor, tensor 1, in theend
. -
Next, we consider the contraction between tensor 3 and tensor 0 in the tensor ring. The merged tensor is
$3\rightarrow 0$ , not$0\rightarrow 1\rightarrow 2\rightarrow 3$ . Hence, tensor 3 is the leftmost tensor, and tensor 0 is the rightmost tensor.
Thanks for your advice @shixun404 ! Your consideration is indeed a very important point. After many tests, we found that our Start-End update can avoid this situation.
At the same time, thanks to Jie’s help @zhangjie119 , we finally found the cause of the problem through multiple printings and breakpoints. We originally wanted to define the variable s1 = self.start[k, selected_edge_id], but found that the file will treat s1 as a pointer in actual use. Cause a series of update errors, solved by s1 = 0+self.start[k, selected_edge_id]. Haha, this problem is really hard to find.