https://github.com/rballester/tntorch
Revision 7627605296f5e70aae097ba51eeb3143211fab91 authored by Mikhail on 03 August 2021, 18:59:05 UTC, committed by Mikhail on 03 August 2021, 19:00:41 UTC
1 parent ff02c50
Raw File
Tip revision: 7627605296f5e70aae097ba51eeb3143211fab91 authored by Mikhail on 03 August 2021, 18:59:05 UTC
unified lstsq calls for diffcross
Tip revision: 7627605
test_init.py
import numpy as np
import tntorch as tn
import torch
torch.set_default_dtype(torch.float64)


def test_from_ndarray():

    for i in range(100):
        gt = np.random.rand(*np.random.randint(1, 8, np.random.randint(1, 6)))
        t = tn.Tensor(gt)
        reco = t.numpy()
        assert np.linalg.norm(gt - reco) / np.linalg.norm(gt) <+ 1e-7
back to top