Commit e5330c16 authored by Robert Kimball's avatar Robert Kimball Committed by Scott Cyphers

Minimize #include in op headers (#3553)

* cleanup op includes in headers

* fix missing include
parent 9c9bfa03
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/all.hpp" #include "ngraph/op/all.hpp"
#include "ngraph/graph_util.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
...@@ -38,3 +39,8 @@ shared_ptr<Node> op::All::copy_with_new_args(const NodeVector& new_args) const ...@@ -38,3 +39,8 @@ shared_ptr<Node> op::All::copy_with_new_args(const NodeVector& new_args) const
check_new_args_count(this, new_args); check_new_args_count(this, new_args);
return make_shared<All>(new_args.at(0), new_args.at(1)); return make_shared<All>(new_args.at(0), new_args.at(1));
} }
shared_ptr<Node> op::All::get_default_value() const
{
return make_constant_from_string("1", get_element_type(), get_shape());
}
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp"
#include "ngraph/op/util/logical_reduction.hpp" #include "ngraph/op/util/logical_reduction.hpp"
namespace ngraph namespace ngraph
...@@ -48,10 +45,7 @@ namespace ngraph ...@@ -48,10 +45,7 @@ namespace ngraph
std::shared_ptr<Node> copy_with_new_args(const NodeVector& new_args) const override; std::shared_ptr<Node> copy_with_new_args(const NodeVector& new_args) const override;
/// \return The default value for All. /// \return The default value for All.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("1", get_element_type(), get_shape());
}
}; };
} }
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/any.hpp" #include "ngraph/op/any.hpp"
#include "ngraph/graph_util.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
...@@ -38,3 +39,8 @@ shared_ptr<Node> op::Any::copy_with_new_args(const NodeVector& new_args) const ...@@ -38,3 +39,8 @@ shared_ptr<Node> op::Any::copy_with_new_args(const NodeVector& new_args) const
check_new_args_count(this, new_args); check_new_args_count(this, new_args);
return make_shared<Any>(new_args.at(0), new_args.at(1)); return make_shared<Any>(new_args.at(0), new_args.at(1));
} }
shared_ptr<Node> op::Any::get_default_value() const
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
...@@ -16,9 +16,6 @@ ...@@ -16,9 +16,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp"
#include "ngraph/op/util/logical_reduction.hpp" #include "ngraph/op/util/logical_reduction.hpp"
namespace ngraph namespace ngraph
...@@ -49,10 +46,7 @@ namespace ngraph ...@@ -49,10 +46,7 @@ namespace ngraph
copy_with_new_args(const NodeVector& new_args) const override; copy_with_new_args(const NodeVector& new_args) const override;
/// \return The default value for Any. /// \return The default value for Any.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
}; };
} }
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/argmax.hpp" #include "ngraph/op/argmax.hpp"
#include "ngraph/graph_util.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/util/index_reduction.hpp" #include "ngraph/op/util/index_reduction.hpp"
namespace ngraph namespace ngraph
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/argmin.hpp" #include "ngraph/op/argmin.hpp"
#include "ngraph/graph_util.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/util/index_reduction.hpp" #include "ngraph/op/util/index_reduction.hpp"
namespace ngraph namespace ngraph
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/avg_pool.hpp" #include "ngraph/op/avg_pool.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/validation_util.hpp" #include "ngraph/validation_util.hpp"
using namespace std; using namespace std;
...@@ -224,6 +225,11 @@ shared_ptr<Node> op::AvgPool::copy_with_new_args(const NodeVector& new_args) con ...@@ -224,6 +225,11 @@ shared_ptr<Node> op::AvgPool::copy_with_new_args(const NodeVector& new_args) con
m_ceil_mode); m_ceil_mode);
} }
shared_ptr<Node> op::AvgPool::get_default_value() const
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
const string op::AvgPoolBackprop::type_name("AvgPoolBackprop"); const string op::AvgPoolBackprop::type_name("AvgPoolBackprop");
op::AvgPoolBackprop::AvgPoolBackprop(const Shape& forward_arg_shape, op::AvgPoolBackprop::AvgPoolBackprop(const Shape& forward_arg_shape,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/op/util/attr_types.hpp" #include "ngraph/op/util/attr_types.hpp"
...@@ -157,10 +156,7 @@ namespace ngraph ...@@ -157,10 +156,7 @@ namespace ngraph
bool get_ceil_mode() const; bool get_ceil_mode() const;
void set_ceil_mode(bool ceil_mode); void set_ceil_mode(bool ceil_mode);
/// \return The default value for AvgPool. /// \return The default value for AvgPool.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
protected: protected:
Shape m_window_shape; Shape m_window_shape;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "ngraph/deprecated.hpp" #include "ngraph/deprecated.hpp"
#include "ngraph/node.hpp" #include "ngraph/node.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/util.hpp"
namespace ngraph namespace ngraph
{ {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "ngraph/coordinate_diff.hpp" #include "ngraph/coordinate_diff.hpp"
#include "ngraph/node.hpp" #include "ngraph/node.hpp"
#include "ngraph/runtime/aligned_buffer.hpp" #include "ngraph/runtime/aligned_buffer.hpp"
#include "ngraph/type/bfloat16.hpp"
#include "ngraph/type/element_type.hpp" #include "ngraph/type/element_type.hpp"
#include "ngraph/util.hpp" #include "ngraph/util.hpp"
......
...@@ -211,6 +211,11 @@ void op::Convolution::generate_adjoints(autodiff::Adjoints& adjoints, const Node ...@@ -211,6 +211,11 @@ void op::Convolution::generate_adjoints(autodiff::Adjoints& adjoints, const Node
m_data_dilation_strides)); m_data_dilation_strides));
} }
shared_ptr<Node> op::Convolution::get_default_value() const
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
const string op::ConvolutionBackpropData::type_name{"ConvolutionBackpropData"}; const string op::ConvolutionBackpropData::type_name{"ConvolutionBackpropData"};
op::ConvolutionBackpropData::ConvolutionBackpropData(const Shape& data_batch_shape, op::ConvolutionBackpropData::ConvolutionBackpropData(const Shape& data_batch_shape,
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#pragma once #pragma once
#include "ngraph/coordinate_diff.hpp" #include "ngraph/coordinate_diff.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/op/util/attr_types.hpp" #include "ngraph/op/util/attr_types.hpp"
...@@ -180,10 +179,7 @@ namespace ngraph ...@@ -180,10 +179,7 @@ namespace ngraph
const PadType& get_pad_type() const { return m_pad_type; } const PadType& get_pad_type() const { return m_pad_type; }
void set_pad_type(const PadType& pad_type) { m_pad_type = pad_type; } void set_pad_type(const PadType& pad_type) { m_pad_type = pad_type; }
/// \return The default value for Convolution. /// \return The default value for Convolution.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
protected: protected:
Strides m_window_movement_strides; Strides m_window_movement_strides;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp" #include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/util/index_reduction.hpp" #include "ngraph/op/util/index_reduction.hpp"
namespace ngraph namespace ngraph
......
...@@ -16,9 +16,7 @@ ...@@ -16,9 +16,7 @@
#pragma once #pragma once
#include "ngraph/op/op.hpp"
#include "ngraph/op/util/unary_elementwise_arithmetic.hpp" #include "ngraph/op/util/unary_elementwise_arithmetic.hpp"
#include "ngraph/util.hpp"
namespace ngraph namespace ngraph
{ {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#pragma once #pragma once
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/util.hpp"
namespace ngraph namespace ngraph
{ {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/experimental/generate_mask.hpp" #include "ngraph/op/experimental/generate_mask.hpp"
#include "ngraph/op/constant.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include "ngraph/op/constant.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/state/rng_state.hpp"
namespace ngraph namespace ngraph
{ {
namespace op namespace op
......
...@@ -144,6 +144,11 @@ shared_ptr<Node> op::MaxPool::copy_with_new_args(const NodeVector& new_args) con ...@@ -144,6 +144,11 @@ shared_ptr<Node> op::MaxPool::copy_with_new_args(const NodeVector& new_args) con
m_ceil_mode); m_ceil_mode);
} }
shared_ptr<Node> op::MaxPool::get_default_value() const
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
const string op::MaxPoolBackprop::type_name{"MaxPoolBackprop"}; const string op::MaxPoolBackprop::type_name{"MaxPoolBackprop"};
op::MaxPoolBackprop::MaxPoolBackprop(const Output<Node>& arg_forward, op::MaxPoolBackprop::MaxPoolBackprop(const Output<Node>& arg_forward,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/op/util/attr_types.hpp" #include "ngraph/op/util/attr_types.hpp"
...@@ -123,10 +122,7 @@ namespace ngraph ...@@ -123,10 +122,7 @@ namespace ngraph
bool get_ceil_mode() const { return m_ceil_mode; } bool get_ceil_mode() const { return m_ceil_mode; }
void set_ceil_mode(bool ceil_mode) { m_ceil_mode = ceil_mode; } void set_ceil_mode(bool ceil_mode) { m_ceil_mode = ceil_mode; }
/// \return The default value for MaxPool. /// \return The default value for MaxPool.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
protected: protected:
virtual void generate_adjoints(autodiff::Adjoints& adjoints, virtual void generate_adjoints(autodiff::Adjoints& adjoints,
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/product.hpp" #include "ngraph/op/product.hpp"
#include "ngraph/graph_util.hpp"
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
...@@ -38,3 +39,8 @@ shared_ptr<Node> op::Product::copy_with_new_args(const NodeVector& new_args) con ...@@ -38,3 +39,8 @@ shared_ptr<Node> op::Product::copy_with_new_args(const NodeVector& new_args) con
check_new_args_count(this, new_args); check_new_args_count(this, new_args);
return make_shared<Product>(new_args.at(0), get_reduction_axes()); return make_shared<Product>(new_args.at(0), get_reduction_axes());
} }
shared_ptr<Node> op::Product::get_default_value() const
{
return ngraph::make_constant_from_string("1", get_element_type(), get_shape());
}
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include "ngraph/graph_util.hpp"
#include "ngraph/op/util/arithmetic_reduction.hpp" #include "ngraph/op/util/arithmetic_reduction.hpp"
namespace ngraph namespace ngraph
...@@ -46,10 +45,7 @@ namespace ngraph ...@@ -46,10 +45,7 @@ namespace ngraph
Product(const Output<Node>& arg, const Output<Node>& reduction_axes); Product(const Output<Node>& arg, const Output<Node>& reduction_axes);
/// \return The default value for Product. /// \return The default value for Product.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("1", get_element_type(), get_shape());
}
virtual std::shared_ptr<Node> virtual std::shared_ptr<Node>
copy_with_new_args(const NodeVector& new_args) const override; copy_with_new_args(const NodeVector& new_args) const override;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include "ngraph/coordinate_diff.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
namespace ngraph namespace ngraph
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/op/util/binary_elementwise_arithmetic.hpp" #include "ngraph/op/util/binary_elementwise_arithmetic.hpp"
#include "ngraph/op/util/unary_elementwise_arithmetic.hpp" #include "ngraph/op/util/unary_elementwise_arithmetic.hpp"
#include "ngraph/util.hpp"
#include <memory> #include <memory>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
//***************************************************************************** //*****************************************************************************
#include "ngraph/op/sum.hpp" #include "ngraph/op/sum.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/broadcast.hpp" #include "ngraph/op/broadcast.hpp"
using namespace std; using namespace std;
...@@ -49,3 +50,8 @@ void op::Sum::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& ...@@ -49,3 +50,8 @@ void op::Sum::generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector&
adjoints.add_delta(x, make_shared<op::Broadcast>(delta, x_shape, get_reduction_axes())); adjoints.add_delta(x, make_shared<op::Broadcast>(delta, x_shape, get_reduction_axes()));
} }
shared_ptr<Node> op::Sum::get_default_value() const
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#pragma once #pragma once
#include "ngraph/axis_set.hpp" #include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
#include "ngraph/op/util/arithmetic_reduction.hpp" #include "ngraph/op/util/arithmetic_reduction.hpp"
...@@ -96,10 +95,7 @@ namespace ngraph ...@@ -96,10 +95,7 @@ namespace ngraph
copy_with_new_args(const NodeVector& new_args) const override; copy_with_new_args(const NodeVector& new_args) const override;
/// \return The default value for Sum. /// \return The default value for Sum.
virtual std::shared_ptr<Node> get_default_value() const override virtual std::shared_ptr<Node> get_default_value() const override;
{
return ngraph::make_constant_from_string("0", get_element_type(), get_shape());
}
protected: protected:
virtual void generate_adjoints(autodiff::Adjoints& adjoints, virtual void generate_adjoints(autodiff::Adjoints& adjoints,
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <memory> #include <memory>
#include "ngraph/axis_set.hpp" #include "ngraph/axis_set.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/op/op.hpp" #include "ngraph/op/op.hpp"
namespace ngraph namespace ngraph
......
...@@ -130,6 +130,7 @@ ...@@ -130,6 +130,7 @@
#include "ngraph/runtime/cpu/op/rnn.hpp" #include "ngraph/runtime/cpu/op/rnn.hpp"
#include "ngraph/runtime/cpu/op/sigmoid_mul.hpp" #include "ngraph/runtime/cpu/op/sigmoid_mul.hpp"
#include "ngraph/runtime/cpu/op/update_slice.hpp" #include "ngraph/runtime/cpu/op/update_slice.hpp"
#include "ngraph/state/rng_state.hpp"
#include "ngraph/type/element_type.hpp" #include "ngraph/type/element_type.hpp"
#include "ngraph/util.hpp" #include "ngraph/util.hpp"
......
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