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 tried to use dmg_cross to interpolate this exemplary random tensor,
N = list(test.shape)
x = tntt.interpolate.dmrg_cross(func, N, eps=10**(-8))
I got the error message:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
coro = func()
^^^^^^
File "<input>", line 1, in <module>
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/boyuanshi/Desktop/second_project/equilibrium_v2/Screened_Interactions_Plot.py", line 61, in <module>
x = tntt.interpolate.dmrg_cross(func, N, eps=10**(-8))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/boyuanshi/.conda/envs/Desktop/lib/python3.11/site-packages/torchTT-2.0-py3.11-macosx-10.9-x86_64.egg/torchtt/interpolate.py", line 514, in dmrg_cross
supercore = tn.reshape(function(eval_index),[rank[k],N[k],N[k+1],rank[k+2]])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: shape '[1, 10, 10, 2]' is invalid for input of size 1
I am quite confused why it is the case?
The text was updated successfully, but these errors were encountered:
It seems that I magically solve the issue by adding 0./(2+tn.exp(tn.sum(I, 1))) to the function and also change the data type to tn.float64. Not known why.
The output of the function handle should be float and of shape (m,) for an input of shape (m,d).
The provided hanndle returns a (1,) torch tensor. It can be modified as
def func(args):
return tn.tensor([tn.from_numpy(test)[*a] for a in args], dtype=tn.float64)
Regarding the complex numbers, right now only the real p is approximated. One alternative is to cross approximate real and imaginary separately. I would need to do some work to support complex numbers in all operations.
I tried to use interpolate.dmrg_cross() from a numpy array.
Generate a random array:
import numpy as np
import torch as tn
import torchtt as tntt
test = np.random.rand(10, 10, 10)
Define the function in this way:
When I tried to use dmg_cross to interpolate this exemplary random tensor,
I got the error message:
I am quite confused why it is the case?
The text was updated successfully, but these errors were encountered: