Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case "CsvDataFile" FAILED #12

Closed
smsajjadi opened this issue Nov 5, 2017 · 9 comments
Closed

Test case "CsvDataFile" FAILED #12

smsajjadi opened this issue Nov 5, 2017 · 9 comments
Labels

Comments

@smsajjadi
Copy link

Hi

I am building N2D2 without CUDA on ubuntu 14.04
The problem is echoed below:

`[ 97%] Generating ../bin/tests/class_CsvDataFile.passed
Test case "CsvDataFile" FAILED with 0 error(s), 2 failure(s), 10 success(es):
Test "read" FAILED (5/6):
Failure: "mat.at(i, 1) != 0.5 + i * 0.1 with values 0.6 != 0.6" line 46 in file /home/hamid/N2D2/N2D2-master/tests/DataFile/class_CsvDataFile.cpp
Test "write" FAILED (5/6):
Failure: "mat.at(i, 1) != 0.5 + i * 0.1 with values 0.6 != 0.6" line 70 in file /home/hamid/N2D2/N2D2-master/tests/DataFile/class_CsvDataFile.cpp

Test summary: FAIL
Number of test cases ran: 1
Tests that succeeded: 10
Tests with errors: 0
Tests that failed: 2
Tests skipped: 0
make[2]: *** [bin/tests/class_CsvDataFile.passed] Error 1
make[1]: *** [tests/CMakeFiles/run_class_CsvDataFile.dir/all] Error 2
make: *** [all] Error 2
`

@olivierbichler-cea
Copy link
Contributor

olivierbichler-cea commented Nov 10, 2017

Hi,
This seems to be a floating point precision issue, but it is strange, as I am unable to reproduce it on any of our system...
Could you try to replacing in tests/DataFile/class_CsvDataFile.cpp:
lines 45 & 46

ASSERT_EQUALS(mat.at<double>(i, 0), i + 1.0);
ASSERT_EQUALS(mat.at<double>(i, 1), 0.5 + i * 0.1);

lines 69 & 70

ASSERT_EQUALS(mat.at<double>(i, 0), i + 1.0);
ASSERT_EQUALS(mat.at<double>(i, 1), 0.5 + i * 0.1);

Replace
ASSERT_EQUALS(x, y);
by
ASSERT_EQUALS_DELTA(x, y, 1e-9);

Can you tell me for what precision (1e-9, 1e-12, ...) it works?

@smsajjadi
Copy link
Author

smsajjadi commented Nov 11, 2017

Hi

Just adding a delta of 1e-15 let the tests pass that point. But in the next step there is an error in the class_Database code which is not corrected by such a change:

`Test case "Database" FAILED with 0 error(s), 10 failure(s), 422 success(es):
Test "load" PASSED (6/6).
Test "load_empty_database" PASSED (2/2).
Test "partitionStimuli" PASSED (60/60).
Test "partitionStimuli__throw" PASSED (6/6).
Test "getLabelsStimuliSetIndexes" PASSED (40/40).
Test "partitionStimuliPerLabel" PASSED (60/60).
Test "partitionStimuli__learn_validation_test" FAILED (55/60):
Failure: "db.getNbStimuli(Database::Learn) != (unsigned int)(learn * 100) with values 70 != 69" line 295 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 70 != 69" line 297 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Test) != (unsigned int)(test * 100) with values 70 != 69" line 298 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 30 != 29" line 297 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 30 != 29" line 297 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Test "partitionStimuliPerLabel__learn_validation_test" FAILED (55/60):
Failure: "db.getNbStimuli(Database::Learn) != (unsigned int)(learn * 100) with values 70 != 69" line 330 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 70 != 69" line 332 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Test) != (unsigned int)(test * 100) with values 70 != 69" line 333 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 30 != 29" line 332 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Failure: "db.getNbStimuli(Database::Validation) != (unsigned int)(validation * 100) with values 30 != 29" line 332 in file /home/hamid/N2D2/N2D2-master/tests/Database/class_Database.cpp
Test "getLabelName" PASSED (30/30).
Test "getLabelID" PASSED (30/30).
Test "removeLabel" PASSED (78/78).

Test summary: FAIL
Number of test cases ran: 1
Tests that succeeded: 422
Tests with errors: 0
Tests that failed: 10
Tests skipped: 0
make[2]: *** [bin/tests/class_Database.passed] Error 1
make[1]: *** [tests/CMakeFiles/run_class_Database.dir/all] Error 2
make: *** [all] Error 2
`

In case it is useful: this is a vmware image on an Intel i3 system

@olivierbichler-cea
Copy link
Contributor

This is still a precision issue. For example, if the learn value is 0.7, the result for (unsigned int)(learn * 100) should be 70, but on your system it's 69 probably because de value before conversion to int is 0.699999999999...
Adding a std::ceil() before the int conversion should solve this issue.

However, I am wondering, what is your system exactly? Processor, compiler version?

@smsajjadi
Copy link
Author

The processor is an Intel i3 (exactly i3-4150)

Installation was performed on a VMWare Ubuntu 14.04 image, whose gcc version is:

  • gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)

@smsajjadi
Copy link
Author

The next step in build with the same type of error is in the end of the class_FcCell_Frame.cpp where the delta is needed to expanded to 1e-5!!!
Thereafter the tests succeeded and cmake finished.

@smsajjadi
Copy link
Author

In the meanwhile we had tried to install N2D2 on a Windows system. There were other errors encountered:

Error 1 error C2783: 'std::shared_ptr<_Ty> std::make_shared(_Types &&...)' : could not deduce template argument for '_Ty' D:\N2D2-master\include\Cell\BatchNormCell_Frame.hpp 35 1 N2D2-OS

It's a Core I5-4460 system with Windows 7SP1, and Microsoft Visual Studio 2013 (v12.0.21005.1) and dotnet framework v4.6.01590

@olivierbichler-cea
Copy link
Contributor

This is a bug in Visual C++ 2013, that was corrected in Visual C++ 2013 Update 3 (see https://blogs.msdn.microsoft.com/vcblog/2014/08/04/bugs-fixed-in-visual-studio-2013-update-3/ => "Using std::make_shared for non-static data member initialization results in a template argument deduction error.").

@olivierbichler-cea
Copy link
Contributor

I fixed the precision errors in 81dcbf9.
Could you please check that it works out of the box now for your system?

As for the Windows compilation error, I updated the README and documentation to indicate that the minimum required version for Visual Studio is 2013.3 (2013 Update 3).
Did you have the possibility to update Visual Studio? In this case, did manage to successfully compile N2D2 on Visual Studio 2013.3?

If you don't have the possibility to update Visual Studio, replacing std::make_shared<> by std::shared_ptr<TanhActivation_Frame<Float_T> >(new TanhActivation_Frame<Float_T>()) might do the trick, but there is probably a lot of places in the code that would need to be changed that way...

@olivierbichler-cea
Copy link
Contributor

No more feedback, closing the issue as the bugs should be fixed.
Please don't hesitate to comment and reopen this issue if you still encounter a related bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants