[Tensor] Fix invalid getIdx() method
Compare changes
The Tensor getIdx() method for computing flat index from a coords list is wrong. There were two issues:
This MR fixes getIdx() and add unit tests for get()/set()/getIdx() with index or coords.
After adding the first commit (unit tests) here is the output of the unit tests:
unit_testsbuild/unit_tests/tests_aidge_core --rng-seed 0 -c 'Tensor set/get'
/data/Test_Tensor.cpp:337: FAILED:
{Unknown expression after the reported line}
due to a fatal error condition:
SIGSEGV - Segmentation violation signal
===============================================================================
test cases: 5 | 4 passed | 1 failed
assertions: 232 | 231 passed | 1 failed
Segmentation fault
After applying the second patch which fixes the issue, here is the output:
unit_testsbuild/unit_tests/tests_aidge_core --rng-seed 0 -c 'Tensor set/get'
===============================================================================
All tests passed (8009 assertions in 77 test cases)
First commit: add unit tests Tensor set/get
to Tensor unit tests (note that with this commit in isolation the unit tests fail.
Second Commit: fix implementation of getIdx()
Third commit: minor change to getStorageIdx()
which did not assert dimensions size before checking coords values.
No major modification.
No forecasted todo.
Copyright © Eclipse Foundation, Inc. All Rights Reserved. Privacy Policy | Terms of Use | Copyright Agent