Skip to content
Snippets Groups Projects

Refactoring Tensor

Closed laurent soulier requested to merge fix/TensorPIMPL into main
Compare and
72 files
+ 5250
2353
Compare changes
  • Side-by-side
  • Inline
Files
72
+ 0
44
"""
Copyright (c) 2023 CEA-List
This program and the accompanying materials are made available under the
terms of the Eclipse Public License 2.0 which is available at
http://www.eclipse.org/legal/epl-2.0.
SPDX-License-Identifier: EPL-2.0
"""
import unittest
import aidge_core
from functools import reduce
import numpy as np
class test_tensor(unittest.TestCase):
"""
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_getcoord_getidx(self):
dims = [2,2,2]
size = reduce((lambda x, y: x*y), dims)
np_array = np.arange(size).reshape(dims)
t = aidge_core.Tensor(np_array)
for i in range(size):
coord = t.get_coord(i)
idx = t.get_idx(coord)
self.assertEqual(idx, i)
if __name__ == '__main__':
unittest.main()
Loading