pyuni10_v3: pyuni10.Contract fails when the result is a rank-0 tensor
Summary
pyuni10.Contract fails when the result is a rank-0 tensor
Steps to reproduce
code:
import pyuni10
print(pyuni10.pyuni10.__version__)
print(pyuni10.cytnx.__version__)
T1 = pyuni10.UniTensor(pyuni10.ones([2,2]),1)
T2 = pyuni10.UniTensor(pyuni10.ones([2,2]),1)
T1.set_labels([1,2])
T2.set_labels([2,1])
T1.print_diagram()
T2.print_diagram()
pyuni10.Contract(T1, T2)
output
3.0.0
0.7.0
-----------------------
tensor Name :
tensor Rank : 2
block_form : false
is_diag : False
on device : cytnx device: CPU
-------------
/ \
1 ____| 2 2 |____ 2
\ /
-------------
-----------------------
tensor Name :
tensor Rank : 2
block_form : false
is_diag : False
on device : cytnx device: CPU
-------------
/ \
2 ____| 2 2 |____ 1
\ /
-------------
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-1716b0ce0cec> in <module>
8 T1.print_diagram()
9 T2.print_diagram()
---> 10 pyuni10.Contract(T1, T2)
RuntimeError:
# Cytnx error occur at void cytnx::Tensor_impl::reshape_(const std::vector<cytnx_int64> &)
# error: [ERROR] new shape exceed the total number of elements.
# file : /private/var/folders/26/5351ptkn06s590c1x8fv1jdm0000gn/T/pip-req-build-5h517ung/cytnx/include/Tensor.hpp (230)