Unverified Commit 23442974 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Add namespace to NGRAPH_OP macro to address backend fusion ops (#1656)

parent 7610ae42
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// When you are done you should undef the macro // When you are done you should undef the macro
// As an example if you wanted to make a list of all op names as strings you could do this: // As an example if you wanted to make a list of all op names as strings you could do this:
// //
// #define NGRAPH_OP(a) #a, // #define NGRAPH_OP(a,b) #a,
// std::vector<std::string> op_names{ // std::vector<std::string> op_names{
// #include "this include file name" // #include "this include file name"
// }; // };
...@@ -32,82 +32,93 @@ ...@@ -32,82 +32,93 @@
// "Acos", // "Acos",
// ... // ...
// //
// #define NGRAPH_OP(a,b) b::a,
// std::vector<std::string> op_names{
// #include "this include file name"
// };
// #undef NGRAPH_OP
//
// This sample expands to a list like this:
// ngraph::op::Abs,
// ngraph::op::Acos,
// ...
//
// It's that easy. You can use this for fun and profit. // It's that easy. You can use this for fun and profit.
NGRAPH_OP(Abs) NGRAPH_OP(Abs, ngraph::op)
NGRAPH_OP(Acos) NGRAPH_OP(Acos, ngraph::op)
NGRAPH_OP(Add) NGRAPH_OP(Add, ngraph::op)
NGRAPH_OP(AllReduce) NGRAPH_OP(AllReduce, ngraph::op)
NGRAPH_OP(And) NGRAPH_OP(And, ngraph::op)
NGRAPH_OP(ArgMax) NGRAPH_OP(ArgMax, ngraph::op)
NGRAPH_OP(ArgMin) NGRAPH_OP(ArgMin, ngraph::op)
NGRAPH_OP(Asin) NGRAPH_OP(Asin, ngraph::op)
NGRAPH_OP(Atan) NGRAPH_OP(Atan, ngraph::op)
NGRAPH_OP(AvgPool) NGRAPH_OP(AvgPool, ngraph::op)
NGRAPH_OP(AvgPoolBackprop) NGRAPH_OP(AvgPoolBackprop, ngraph::op)
NGRAPH_OP(BatchNorm) NGRAPH_OP(BatchNorm, ngraph::op)
NGRAPH_OP(BatchNormBackprop) NGRAPH_OP(BatchNormBackprop, ngraph::op)
NGRAPH_OP(Broadcast) NGRAPH_OP(Broadcast, ngraph::op)
NGRAPH_OP(Ceiling) NGRAPH_OP(Ceiling, ngraph::op)
NGRAPH_OP(Concat) NGRAPH_OP(Concat, ngraph::op)
NGRAPH_OP(Constant) NGRAPH_OP(Constant, ngraph::op)
NGRAPH_OP(Convert) NGRAPH_OP(Convert, ngraph::op)
NGRAPH_OP(Convolution) NGRAPH_OP(Convolution, ngraph::op)
NGRAPH_OP(ConvolutionBackpropData) NGRAPH_OP(ConvolutionBackpropData, ngraph::op)
NGRAPH_OP(ConvolutionBackpropFilters) NGRAPH_OP(ConvolutionBackpropFilters, ngraph::op)
NGRAPH_OP(Cos) NGRAPH_OP(Cos, ngraph::op)
NGRAPH_OP(Cosh) NGRAPH_OP(Cosh, ngraph::op)
NGRAPH_OP(Divide) NGRAPH_OP(Divide, ngraph::op)
NGRAPH_OP(Dot) NGRAPH_OP(Dot, ngraph::op)
NGRAPH_OP(Equal) NGRAPH_OP(Equal, ngraph::op)
NGRAPH_OP(Exp) NGRAPH_OP(Exp, ngraph::op)
NGRAPH_OP(Floor) NGRAPH_OP(Floor, ngraph::op)
NGRAPH_OP(FunctionCall) NGRAPH_OP(FunctionCall, ngraph::op)
NGRAPH_OP(GetOutputElement) NGRAPH_OP(GetOutputElement, ngraph::op)
NGRAPH_OP(Greater) NGRAPH_OP(Greater, ngraph::op)
NGRAPH_OP(GreaterEq) NGRAPH_OP(GreaterEq, ngraph::op)
NGRAPH_OP(Less) NGRAPH_OP(Less, ngraph::op)
NGRAPH_OP(LessEq) NGRAPH_OP(LessEq, ngraph::op)
NGRAPH_OP(Log) NGRAPH_OP(Log, ngraph::op)
NGRAPH_OP(LRN) NGRAPH_OP(LRN, ngraph::op)
NGRAPH_OP(Max) NGRAPH_OP(Max, ngraph::op)
NGRAPH_OP(Maximum) NGRAPH_OP(Maximum, ngraph::op)
NGRAPH_OP(MaxPool) NGRAPH_OP(MaxPool, ngraph::op)
NGRAPH_OP(MaxPoolBackprop) NGRAPH_OP(MaxPoolBackprop, ngraph::op)
NGRAPH_OP(Min) NGRAPH_OP(Min, ngraph::op)
NGRAPH_OP(Minimum) NGRAPH_OP(Minimum, ngraph::op)
NGRAPH_OP(Multiply) NGRAPH_OP(Multiply, ngraph::op)
NGRAPH_OP(Negative) NGRAPH_OP(Negative, ngraph::op)
NGRAPH_OP(Not) NGRAPH_OP(Not, ngraph::op)
NGRAPH_OP(NotEqual) NGRAPH_OP(NotEqual, ngraph::op)
NGRAPH_OP(OneHot) NGRAPH_OP(OneHot, ngraph::op)
NGRAPH_OP(Or) NGRAPH_OP(Or, ngraph::op)
NGRAPH_OP(Pad) NGRAPH_OP(Pad, ngraph::op)
NGRAPH_OP(Parameter) NGRAPH_OP(Parameter, ngraph::op)
NGRAPH_OP(Power) NGRAPH_OP(Power, ngraph::op)
NGRAPH_OP(Product) NGRAPH_OP(Product, ngraph::op)
NGRAPH_OP(Reduce) NGRAPH_OP(Reduce, ngraph::op)
NGRAPH_OP(ReduceWindow) NGRAPH_OP(ReduceWindow, ngraph::op)
NGRAPH_OP(Relu) NGRAPH_OP(Relu, ngraph::op)
NGRAPH_OP(ReluBackprop) NGRAPH_OP(ReluBackprop, ngraph::op)
NGRAPH_OP(ReplaceSlice) NGRAPH_OP(ReplaceSlice, ngraph::op)
NGRAPH_OP(Reshape) NGRAPH_OP(Reshape, ngraph::op)
NGRAPH_OP(Result) NGRAPH_OP(Result, ngraph::op)
NGRAPH_OP(Reverse) NGRAPH_OP(Reverse, ngraph::op)
NGRAPH_OP(ReverseSequence) NGRAPH_OP(ReverseSequence, ngraph::op)
NGRAPH_OP(Select) NGRAPH_OP(Select, ngraph::op)
NGRAPH_OP(SelectAndScatter) NGRAPH_OP(SelectAndScatter, ngraph::op)
NGRAPH_OP(Sigmoid) NGRAPH_OP(Sigmoid, ngraph::op)
NGRAPH_OP(SigmoidBackprop) NGRAPH_OP(SigmoidBackprop, ngraph::op)
NGRAPH_OP(Sign) NGRAPH_OP(Sign, ngraph::op)
NGRAPH_OP(Sin) NGRAPH_OP(Sin, ngraph::op)
NGRAPH_OP(Sinh) NGRAPH_OP(Sinh, ngraph::op)
NGRAPH_OP(Slice) NGRAPH_OP(Slice, ngraph::op)
NGRAPH_OP(Softmax) NGRAPH_OP(Softmax, ngraph::op)
NGRAPH_OP(Sqrt) NGRAPH_OP(Sqrt, ngraph::op)
NGRAPH_OP(StopGradient) NGRAPH_OP(StopGradient, ngraph::op)
NGRAPH_OP(Subtract) NGRAPH_OP(Subtract, ngraph::op)
NGRAPH_OP(Sum) NGRAPH_OP(Sum, ngraph::op)
NGRAPH_OP(Tan) NGRAPH_OP(Tan, ngraph::op)
NGRAPH_OP(Tanh) NGRAPH_OP(Tanh, ngraph::op)
NGRAPH_OP(TopK) NGRAPH_OP(TopK, ngraph::op)
...@@ -119,7 +119,7 @@ function<void(EMIT_ARGS)> runtime::gpu::GPU_Emitter::get_emit_function(const Nod ...@@ -119,7 +119,7 @@ function<void(EMIT_ARGS)> runtime::gpu::GPU_Emitter::get_emit_function(const Nod
// {<Abs typeid>, function<void(EMIT_ARGS)}, // {<Abs typeid>, function<void(EMIT_ARGS)},
// {<Acos typeid>, function<void(EMIT_ARGS)}, // {<Acos typeid>, function<void(EMIT_ARGS)},
// ... // ...
#define NGRAPH_OP(a) {type_index(typeid(ngraph::op::a)), runtime::gpu::GPU_Emitter::emit_##a}, #define NGRAPH_OP(a, b) {type_index(typeid(b::a)), runtime::gpu::GPU_Emitter::emit_##a},
static const map<type_index, function<void(EMIT_ARGS)>> typeid_map{ static const map<type_index, function<void(EMIT_ARGS)>> typeid_map{
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
}; };
......
...@@ -38,7 +38,7 @@ namespace ngraph ...@@ -38,7 +38,7 @@ namespace ngraph
// This defines a collection of function declarations like this // This defines a collection of function declarations like this
// static void emit_Abs(EMIT_ARGS); // static void emit_Abs(EMIT_ARGS);
// static void emit_Acos(EMIT_ARGS); // static void emit_Acos(EMIT_ARGS);
#define NGRAPH_OP(a) static void emit_##a(EMIT_ARGS); #define NGRAPH_OP(a, b) static void emit_##a(EMIT_ARGS);
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
#undef NGRAPH_OP #undef NGRAPH_OP
......
...@@ -72,7 +72,7 @@ using namespace ngraph; ...@@ -72,7 +72,7 @@ using namespace ngraph;
// Abs, // Abs,
// Acos, // Acos,
// ... // ...
#define NGRAPH_OP(a) a, #define NGRAPH_OP(a, b) a,
enum class OP_TYPEID enum class OP_TYPEID
{ {
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
...@@ -85,7 +85,7 @@ static OP_TYPEID get_typeid(const string& s) ...@@ -85,7 +85,7 @@ static OP_TYPEID get_typeid(const string& s)
// {"Abs", OP_TYPEID::Abs}, // {"Abs", OP_TYPEID::Abs},
// {"Acos", OP_TYPEID::Acos}, // {"Acos", OP_TYPEID::Acos},
// ... // ...
#define NGRAPH_OP(a) {#a, OP_TYPEID::a}, #define NGRAPH_OP(a, b) {#a, OP_TYPEID::a},
static const unordered_map<string, OP_TYPEID> typeid_map{ static const unordered_map<string, OP_TYPEID> typeid_map{
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
}; };
......
...@@ -26,7 +26,7 @@ runtime::interpreter::NodeWrapper::NodeWrapper(const shared_ptr<const Node>& nod ...@@ -26,7 +26,7 @@ runtime::interpreter::NodeWrapper::NodeWrapper(const shared_ptr<const Node>& nod
// {"Abs", runtime::interpreter::OP_TYPEID::Abs}, // {"Abs", runtime::interpreter::OP_TYPEID::Abs},
// {"Acos", runtime::interpreter::OP_TYPEID::Acos}, // {"Acos", runtime::interpreter::OP_TYPEID::Acos},
// ... // ...
#define NGRAPH_OP(a) {#a, runtime::interpreter::OP_TYPEID::a}, #define NGRAPH_OP(a, b) {#a, runtime::interpreter::OP_TYPEID::a},
static unordered_map<string, runtime::interpreter::OP_TYPEID> typeid_map{ static unordered_map<string, runtime::interpreter::OP_TYPEID> typeid_map{
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
}; };
......
...@@ -36,7 +36,7 @@ namespace ngraph ...@@ -36,7 +36,7 @@ namespace ngraph
// Abs, // Abs,
// Acos, // Acos,
// ... // ...
#define NGRAPH_OP(a) a, #define NGRAPH_OP(a, b) a,
enum class ngraph::runtime::interpreter::OP_TYPEID enum class ngraph::runtime::interpreter::OP_TYPEID
{ {
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
......
...@@ -103,7 +103,7 @@ using const_data_callback_t = shared_ptr<Node>(const string&, const element::Typ ...@@ -103,7 +103,7 @@ using const_data_callback_t = shared_ptr<Node>(const string&, const element::Typ
// Abs, // Abs,
// Acos, // Acos,
// ... // ...
#define NGRAPH_OP(a) a, #define NGRAPH_OP(a, b) a,
enum class OP_TYPEID enum class OP_TYPEID
{ {
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.hpp"
...@@ -116,7 +116,7 @@ static OP_TYPEID get_typeid(const string& s) ...@@ -116,7 +116,7 @@ static OP_TYPEID get_typeid(const string& s)
// {"Abs", OP_TYPEID::Abs}, // {"Abs", OP_TYPEID::Abs},
// {"Acos", OP_TYPEID::Acos}, // {"Acos", OP_TYPEID::Acos},
// ... // ...
#define NGRAPH_OP(a) {#a, OP_TYPEID::a}, #define NGRAPH_OP(a, b) {#a, OP_TYPEID::a},
static const unordered_map<string, OP_TYPEID> typeid_map{ static const unordered_map<string, OP_TYPEID> typeid_map{
#include "ngraph/op/op_tbl.hpp" #include "ngraph/op/op_tbl.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