Commit 478a94f9 authored by Nick Korovaiko's avatar Nick Korovaiko Committed by Scott Cyphers

Rename Any to Skip since that is exactly what it should have been called from the beginning (#891)

* any -> skip

* run style check
parent 870200d1
......@@ -29,8 +29,8 @@
#include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
using namespace ngraph;
using namespace std;
......@@ -55,7 +55,7 @@ void pass::CoreFusion::construct_relu_pattern()
auto broadcast_pred = [](std::shared_ptr<Node> n) {
return static_cast<bool>(std::dynamic_pointer_cast<op::Broadcast>(n));
};
auto skip_broadcast = std::make_shared<pattern::op::Any>(zero, broadcast_pred);
auto skip_broadcast = std::make_shared<pattern::op::Skip>(zero, broadcast_pred);
auto max = make_shared<op::Maximum>(skip_broadcast, val);
pattern::graph_rewrite_callback callback = [val, zero](pattern::Matcher& m) {
......
......@@ -29,8 +29,8 @@
#include "ngraph/op/parameter.hpp"
#include "ngraph/op/reshape.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/util.hpp"
template <typename T>
......
......@@ -71,9 +71,9 @@ namespace ngraph
return is_match;
}
bool Matcher::match_any(const std::shared_ptr<op::Any>& any,
const std::shared_ptr<Node>& graph_node,
PatternMap& pattern_map)
bool Matcher::match_skip(const std::shared_ptr<op::Skip>& any,
const std::shared_ptr<Node>& graph_node,
PatternMap& pattern_map)
{
auto predicate = any->get_predicate();
......@@ -86,7 +86,7 @@ namespace ngraph
auto args = any->get_arguments();
if (args.size() != 1)
{
throw ngraph_error("Any can only take one argument");
throw ngraph_error("Skip can only take one argument");
}
return match_node(args.at(0), graph_node, pattern_map);
......@@ -111,10 +111,10 @@ namespace ngraph
return match_pattern(label_node, graph_node, pattern_map);
}
if (auto any_node = std::dynamic_pointer_cast<op::Any>(
if (auto any_node = std::dynamic_pointer_cast<op::Skip>(
pattern_node)) //matches PatternSkipOp semantics
{
return match_any(any_node, graph_node, pattern_map);
return match_skip(any_node, graph_node, pattern_map);
}
auto p_pattern_node = pattern_node.get();
......@@ -283,7 +283,7 @@ namespace ngraph
//pre-populate the pattern map for the next cell with the bound nodes
//from the current match. Only bound nodes whose labels are in
//correlated_patterns are pre-populated. Any other labels are
//correlated_patterns are pre-populated. Skip other labels are
//unbounded by default
for (auto cor_pat : m_correlated_patterns)
{
......
......@@ -20,8 +20,8 @@
#include <memory.h>
#include "ngraph/node.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
namespace ngraph
{
......@@ -127,9 +127,9 @@ namespace ngraph
bool match_pattern(const std::shared_ptr<op::Label>& pattern_node,
const std::shared_ptr<Node>& graph_node,
PatternMap& pattern_map);
bool match_any(const std::shared_ptr<op::Any>& pattern_node,
const std::shared_ptr<Node>& graph_node,
PatternMap& pattern_map);
bool match_skip(const std::shared_ptr<op::Skip>& pattern_node,
const std::shared_ptr<Node>& graph_node,
PatternMap& pattern_map);
graph_rewrite_callback m_callback;
size_t m_depth;
......
......@@ -32,7 +32,7 @@ namespace ngraph
class Pattern : public Node
{
public:
/// \brief \p a base class for \sa Any and \sa Label
/// \brief \p a base class for \sa Skip and \sa Label
///
Pattern(const std::string& type_name, const NodeVector& nodes, Predicate pred)
: Node(type_name, nodes)
......
......@@ -25,14 +25,14 @@ namespace ngraph
{
namespace op
{
/// \brief \p Any allows users to specify unexpected nodes in a pattern
/// \brief \p Skip allows users to specify unexpected nodes in a pattern
/// and skip them if a predicate condition is satisfied.
///
class Any : public Pattern
class Skip : public Pattern
{
public:
Any(const std::shared_ptr<Node>& arg, Predicate predicate = nullptr)
: Pattern("Any", NodeVector{arg}, predicate)
Skip(const std::shared_ptr<Node>& arg, Predicate predicate = nullptr)
: Pattern("Skip", NodeVector{arg}, predicate)
{
add_output(arg->get_element_type(), arg->get_shape());
}
......
......@@ -42,8 +42,8 @@
#include "ngraph/op/subtract.hpp"
#include "ngraph/op/sum.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/runtime/cpu/op/batch_norm_relu.hpp"
#include "ngraph/runtime/cpu/op/conv_bias.hpp"
#include "ngraph/runtime/cpu/op/conv_relu.hpp"
......@@ -177,8 +177,8 @@ void ngraph::runtime::cpu::pass::CPUFusion::construct_matmul()
return static_cast<bool>(std::dynamic_pointer_cast<op::Reshape>(n));
};
auto skip_w = std::make_shared<pattern::op::Any>(W, reshape_pred);
auto skip_x = std::make_shared<pattern::op::Any>(x, reshape_pred);
auto skip_w = std::make_shared<pattern::op::Skip>(W, reshape_pred);
auto skip_x = std::make_shared<pattern::op::Skip>(x, reshape_pred);
auto pdot = std::make_shared<op::Dot>(skip_w, skip_x);
......
......@@ -27,8 +27,8 @@
#include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
#include "ngraph/runtime/cpu/op/convert_layout.hpp"
#include "ngraph/runtime/cpu/pass/cpu_post_layout_optimizations.hpp"
......
......@@ -31,8 +31,8 @@
#include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
#include "nlohmann/json.hpp"
......
......@@ -36,8 +36,8 @@
#include "ngraph/pass/reshape_elimination.hpp"
#include "ngraph/pass/visualize_tree.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/runtime/cpu/cpu_layout_descriptor.hpp"
#include "ngraph/runtime/cpu/op/batch_norm_relu.hpp"
#include "ngraph/runtime/cpu/op/conv_bias.hpp"
......@@ -83,8 +83,8 @@ TEST(cpu_fusion, gemm_pattern)
return static_cast<bool>(std::dynamic_pointer_cast<op::Reshape>(n));
};
auto skip_w = std::make_shared<pattern::op::Any>(W, reshape_pred);
auto skip_x = std::make_shared<pattern::op::Any>(x, reshape_pred);
auto skip_w = std::make_shared<pattern::op::Skip>(W, reshape_pred);
auto skip_x = std::make_shared<pattern::op::Skip>(x, reshape_pred);
auto pdot = make_shared<op::Dot>(skip_w, skip_x);
auto b = std::make_shared<pattern::op::Label>(C);
......
......@@ -143,7 +143,7 @@ TEST(DISABLED_include, complete)
"ngraph/pass/visualize_tree.hpp",
"ngraph/pattern/core_fusion.hpp",
"ngraph/pattern/matcher.hpp",
"ngraph/pattern/op/any.hpp",
"ngraph/pattern/op/skip.hpp",
"ngraph/pattern/op/label.hpp",
"ngraph/pattern/op/pattern.hpp",
"ngraph/placement.hpp",
......
......@@ -37,8 +37,8 @@
#include "ngraph/pass/graph_rewrite.hpp"
#include "ngraph/pass/manager.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/runtime/cpu/pass/cpu_fusion.hpp"
#include "ngraph/serializer.hpp"
#include "util/matcher.hpp"
......@@ -402,11 +402,11 @@ TEST(pattern, matcher)
ASSERT_TRUE(n.match(a, a));
auto abs = make_shared<op::Abs>(a);
auto any = std::make_shared<pattern::op::Any>(a);
auto any = std::make_shared<pattern::op::Skip>(a);
ASSERT_TRUE(n.match(any, abs));
auto any_false =
std::make_shared<pattern::op::Any>(a, [](std::shared_ptr<Node> no) { return false; });
std::make_shared<pattern::op::Skip>(a, [](std::shared_ptr<Node> no) { return false; });
ASSERT_TRUE(n.match(any_false, a));
auto pattern = std::make_shared<pattern::op::Label>(a);
......
......@@ -30,8 +30,8 @@
#include "ngraph/pass/manager.hpp"
#include "ngraph/pass/reshape_elimination.hpp"
#include "ngraph/pattern/matcher.hpp"
#include "ngraph/pattern/op/any.hpp"
#include "ngraph/pattern/op/label.hpp"
#include "ngraph/pattern/op/skip.hpp"
#include "ngraph/serializer.hpp"
#include "ngraph/util.hpp"
#include "nlohmann/json.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