quimb icon indicating copy to clipboard operation
quimb copied to clipboard

split_tensor doesn't support absorb=None

Open KTBieniasz opened this issue 1 year ago • 2 comments

What happened?

When calling the split_tensor method of the TensorNetwork class with option absorb=None, the implementation doesn't account for 3 tensors being produced

What did you expect to happen?

No response

Minimal Complete Verifiable Example

C = qtn.Tensor(np.random.random((3,3)),inds=("a","b"), tags="C")
qtn.TensorNetwork([C]).split_tensor("C", "a", absorb=None)

Relevant log output

ValueError                                Traceback (most recent call last)
/tmp/ipykernel_31585/3609951079.py in ?()
----> 1 qtn.TensorNetwork([C]).split_tensor("C","a",absorb=None)

~/miniconda3/envs/py310/lib/python3.10/site-packages/quimb/tensor/tensor_core.py in ?(self, tags, left_inds, **split_opts)
   5015         resulting tensors from the decomposition back into the network. Inplace
   5016         operation.
   5017         """
   5018         (tid,) = self._get_tids_from_tags(tags, which="all")
-> 5019         self._split_tensor_tid(tid, left_inds, **split_opts)

~/miniconda3/envs/py310/lib/python3.10/site-packages/quimb/tensor/tensor_core.py in ?(self, tid, left_inds, **split_opts)
   5001     def _split_tensor_tid(self, tid, left_inds, **split_opts):
   5002         t = self.pop_tensor(tid)
-> 5003         tl, tr = t.split(left_inds=left_inds, get="tensors", **split_opts)
   5004         self.add_tensor(tl)
   5005         self.add_tensor(tr)
   5006         return self

ValueError: too many values to unpack (expected 2)

Anything else we need to know?

No response

Environment

Quimb version 1.8.4

KTBieniasz avatar Sep 10 '24 11:09 KTBieniasz

I'm not sure whether this should simply error with a better message, or add the singular values as a new bond weight tensor into the network.

Were you trying to achieve the latter or just seeing what would happen?

jcmgray avatar Sep 10 '24 15:09 jcmgray

I think the natural behavior would be the latter, especially since just calling Tensor.split(..., absorb=None) creates a TensorNetwork with the singular values tensor.

Yes, I was trying to create the explicit singular value tensors, similar to a Gamma-Lambda canonization, to have a collective view of the singular values in a PEPS.

KTBieniasz avatar Sep 10 '24 16:09 KTBieniasz