Revision ac62d292d7de9b49855b7ca53f2645a10c63246a authored by rballester on 16 September 2022, 15:17:15 UTC, committed by rballester on 16 September 2022, 15:17:15 UTC
1 parent 363d461
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
Computing file changes ...