Commit 5bd169b8 authored by Scott Cyphers's avatar Scott Cyphers

Format

parent d2d200e6
...@@ -164,7 +164,6 @@ void autodiff::Adjoints::add_delta(const std::shared_ptr<Node>& x, ...@@ -164,7 +164,6 @@ void autodiff::Adjoints::add_delta(const std::shared_ptr<Node>& x,
} }
else else
{ {
m_adjoint_map.insert( m_adjoint_map.insert({x.get(), std::make_shared<op::Add>(adjoint_it->second, delta)});
{x.get(), std::make_shared<op::Add>(adjoint_it->second, delta)});
} }
} }
...@@ -166,9 +166,7 @@ std::shared_ptr<Node> Node::backwards_derivative(const std::shared_ptr<Node>& x, ...@@ -166,9 +166,7 @@ std::shared_ptr<Node> Node::backwards_derivative(const std::shared_ptr<Node>& x,
if (adjoints_it == m_adjoint_map.end()) if (adjoints_it == m_adjoint_map.end())
{ {
adjoints_it = adjoints_it =
m_adjoint_map m_adjoint_map.insert({c.get(), autodiff::Adjoints(shared_from_this(), c)}).first;
.insert({c.get(), autodiff::Adjoints(shared_from_this(), c)})
.first;
} }
return adjoints_it->second.get(x); return adjoints_it->second.get(x);
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <memory> #include <memory>
#include <set> #include <set>
#include <string> #include <string>
#include <typeindex>
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
...@@ -76,7 +77,7 @@ namespace ngraph ...@@ -76,7 +77,7 @@ namespace ngraph
bool is_same_op_type(const std::shared_ptr<Node>& node) const bool is_same_op_type(const std::shared_ptr<Node>& node) const
{ {
Node* n = node.get(); Node* n = node.get();
return typeid(*this) == typeid(*n); return std::type_index(typeid(*this)) == std::type_index(typeid(*n));
} }
std::shared_ptr<const ValueType> get_value_type(); std::shared_ptr<const ValueType> get_value_type();
......
...@@ -1882,7 +1882,7 @@ TEST(execute, sin) ...@@ -1882,7 +1882,7 @@ TEST(execute, sin)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return sinf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return sinf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -1908,7 +1908,7 @@ TEST(execute, cos) ...@@ -1908,7 +1908,7 @@ TEST(execute, cos)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return cosf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return cosf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -1934,7 +1934,7 @@ TEST(execute, tan) ...@@ -1934,7 +1934,7 @@ TEST(execute, tan)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return tanf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return tanf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -1959,7 +1959,7 @@ TEST(execute, asin) ...@@ -1959,7 +1959,7 @@ TEST(execute, asin)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return asinf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return asinf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -1984,7 +1984,7 @@ TEST(execute, acos) ...@@ -1984,7 +1984,7 @@ TEST(execute, acos)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return acosf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return acosf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -2009,7 +2009,7 @@ TEST(execute, atan) ...@@ -2009,7 +2009,7 @@ TEST(execute, atan)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return atanf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return atanf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -2034,7 +2034,7 @@ TEST(execute, sinh) ...@@ -2034,7 +2034,7 @@ TEST(execute, sinh)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return sinhf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return sinhf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -2059,7 +2059,7 @@ TEST(execute, cosh) ...@@ -2059,7 +2059,7 @@ TEST(execute, cosh)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return coshf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return coshf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
...@@ -2084,7 +2084,7 @@ TEST(execute, tanh) ...@@ -2084,7 +2084,7 @@ TEST(execute, tanh)
auto result = backend->make_parameterized_tensor_view<element::Float32>(shape); auto result = backend->make_parameterized_tensor_view<element::Float32>(shape);
std::transform( std::transform(
input.begin(), input.end(), input.begin(), [](float f) -> float { return tanhf(f); }); input.begin(), input.end(), input.begin(), [](float v) -> float { return tanhf(v); });
(*cf)({a}, {result}); (*cf)({a}, {result});
ASSERT_EQ(input, result->get_vector()); ASSERT_EQ(input, result->get_vector());
......
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