ai-techsystems / deepC

vendor independent TinyML deep learning library, compiler and inference framework microcomputers and micro-controllers
https://cainvas.ai-tech.systems/
Apache License 2.0
565 stars 86 forks source link

Tensor Assignment operators fail in <double> Tensor #50

Closed gunjannandy closed 5 years ago

gunjannandy commented 5 years ago

test / swig / tensorAssignmentOperators.py (Line No. 220, 380, 554)

def test_Assignment_Add_double_tensor_double_tensor (self):
    temp_np = self.np_double_0_4.copy()
    temp_np += self.np_double_5_9
    temp_dc = self.dc_double_0_4.copy()
    temp_dc += self.dc_double_5_9
    np.testing.assert_array_equal(temp_np, np.array(temp_dc.data()))

Gets output error like this:

gunjan@gunjan-VirtualBox:/Desktop/dnnCompiler/test/swig$ python3 tensorDetailedOperators.py -v
test_Assignment_Add_bool_tensor_bool_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_bool_tensor_bool_tensor (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_double_tensor_double_tensor (__main__.tensorDetailedOperatorsTest) ... FAIL
swig/python detected a memory leak of type 'std::vector< double,std::allocator< double > > *', no destructor found.
test_Assignment_Add_float_tensor_bool_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_float_tensor_float_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_float_tensor_float_tensor (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_float_tensor_int_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_int_tensor_int_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Add_int_tensor_int_tensor (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_float_tensor_bool_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_float_tensor_float_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_float_tensor_float_tensor (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_float_tensor_int_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_int_tensor_int_scalar (__main__.tensorDetailedOperatorsTest) ... ok
test_Assignment_Sub_int_tensor_int_tensor (__main__.tensorDetailedOperatorsTest) ... ok

======================================================================
FAIL: test_Assignment_Add_double_tensor_double_tensor (__main__.tensorDetailedOperatorsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tensorDetailedOperators.py", line 225, in test_Assignment_Add_double_tensor_double_tensor
    np.testing.assert_array_equal(temp_np, np.array(temp_dc.data()))
  File "/home/gunjan/.local/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 913, in assert_array_equal
    verbose=verbose, header='Arrays are not equal')
  File "/home/gunjan/.local/lib/python3.6/site-packages/numpy/testing/_private/utils.py", line 836, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not equal

Mismatch: 100%
 x: array([ 5.,  7.,  9., 11., 13.])
 y: array(<Swig Object of type 'std::vector< double,std::allocator< double > > *' at 0x7f14578c1650>,
      dtype=object)

----------------------------------------------------------------------
Ran 15 tests in 0.010s

FAILED (failures=1)