Revision 241bf7ad2b806f6677a5e23534247f35f3a70f10 authored by rballester on 19 February 2023, 19:35:27 UTC, committed by rballester on 19 February 2023, 19:35:27 UTC
1 parent be80cb2
Raw File
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