A Neural Network in 10 lines of C++ Code (cognitivedemons.wordpress.com) 6 points by PredictorY 8y ago ↗ HN
[–] poster123 8y ago ↗ It compiles and runs fine with g++, but when I try Microsoft's cl.exe version 19.00 I get messages such asxneural.cpp(22): error C2398: Element '1': conversion from 'double' to 'float' requires a narrowing conversionreferring to the code vector<float> X { 5.1, 3.5, 1.4, 0.2, 4.9, 3.0, 1.4, 0.2, 6.2, 3.4, 5.4, 2.3, 5.9, 3.0, 5.1, 1.8 }; If I replace <float> with <double> the code compiles and runs with cl.exe. [–] AnimalMuppet 8y ago ↗ Or transform the numbers to floats, i.e., "5.1" -> "5.1f".
[–] asdsa5325 8y ago ↗ > The core component of the code, the learning algorithm, is only 10 linesAKA gradient descent in 10 lines of C++
[–] horsawlarway 8y ago ↗ A neural network in 10 lines of C++ code... Plus another 200 lines of C++ code.AKA: My "lines of code" count is super tiny if I don't include function definitions!
5 comments
[ 2.9 ms ] story [ 18.8 ms ] threadxneural.cpp(22): error C2398: Element '1': conversion from 'double' to 'float' requires a narrowing conversion
referring to the code
If I replace <float> with <double> the code compiles and runs with cl.exe.AKA gradient descent in 10 lines of C++
AKA: My "lines of code" count is super tiny if I don't include function definitions!