Commit 226a489f authored by Adam Procter's avatar Adam Procter

Move autodiff.cpp to test directory

parent ca569f0e
...@@ -22,6 +22,7 @@ include_directories( ...@@ -22,6 +22,7 @@ include_directories(
) )
set (SRC set (SRC
autodiff.cpp
build_graph.cpp build_graph.cpp
eigen.cpp eigen.cpp
execute.cpp execute.cpp
...@@ -36,7 +37,6 @@ set (SRC ...@@ -36,7 +37,6 @@ set (SRC
topological_sort.cpp topological_sort.cpp
type_prop.cpp type_prop.cpp
util/all_close.cpp util/all_close.cpp
util/autodiff.cpp
util/test_tools.cpp util/test_tools.cpp
util.cpp util.cpp
uuid.cpp uuid.cpp
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "all_close.hpp"
#include "ngraph/autodiff/backprop_derivative.hpp" #include "ngraph/autodiff/backprop_derivative.hpp"
#include "ngraph/autodiff/backprop_function.hpp" #include "ngraph/autodiff/backprop_function.hpp"
#include "ngraph/autodiff/numeric_derivative.hpp" #include "ngraph/autodiff/numeric_derivative.hpp"
#include "ngraph/ngraph.hpp" #include "ngraph/ngraph.hpp"
#include "random.hpp" #include "util/all_close.hpp"
#include "util/random.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
......
...@@ -90,16 +90,14 @@ template <typename T> ...@@ -90,16 +90,14 @@ template <typename T>
bool ngraph::test::all_close(const std::vector<T>& a, const std::vector<T>& b, T rtol, T atol) bool ngraph::test::all_close(const std::vector<T>& a, const std::vector<T>& b, T rtol, T atol)
{ {
assert(a.size() == b.size()); assert(a.size() == b.size());
bool retval = true;
for (size_t i = 0; i < a.size(); ++i) for (size_t i = 0; i < a.size(); ++i)
{ {
if (std::abs(a[i] - b[i]) > atol + rtol * std::abs(b[i])) if (std::abs(a[i] - b[i]) > atol + rtol * std::abs(b[i]))
{ {
std::cout << "a[" << i << "] = " << a[i] << ", b[" << i << "] = " << b[i] << std::endl; return false;
retval = false;
} }
} }
return retval; return true;
} }
template bool ngraph::test::all_close<float>(const std::vector<float>& a, template bool ngraph::test::all_close<float>(const std::vector<float>& a,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment