Commit 1475a9c3 authored by Adam Procter's avatar Adam Procter Committed by Scott Cyphers

clang-format comments: /src/ngraph/pattern (#3471)

* Plant an updated .clang-format in src/ngraph, with overrides in each subdir thereof

* Whoops, forgot to commit the actual .clang-formats

* Remove src/ngraph/type/.clang-format (it was having no effect)

* Remove src/ngraph/distributed/.clang-format (it was having no effect)

* Remove src/ngraph/codegen/.clang-format (only one file was affected, so it's a wash)

* Remove src/ngraph/autodiff/.clang-format (only one file was affected, so it's a wash)

* Un-relax comment wrapping in src/ngraph/state

* Revert "Un-relax comment wrapping in src/ngraph/state"

This reverts commit 41fc50fb92bffb7f5aca4126eb1267f00dcca727.

* Un-relax comment wrapping in src/ngraph/pattern

* Remove .clang-format
parent c0596157
#
# OVERRIDE TO STYLE: Comments do *not* wrap.
#
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
Language: Cpp
Standard: Cpp11
AccessModifierOffset: -4
AlignConsecutiveDeclarations: false
AlignConsecutiveAssignments: false
AlignTrailingComments: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Allman
BreakConstructorInitializersBeforeComma: true
ColumnLimit: 100
CommentPragmas: '.*'
IndentCaseLabels: false
IndentWrappedFunctionNames: true
KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: All
PointerAlignment: Left
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SortIncludes: false
ReflowComments: true
IncludeCategories:
- Regex: '^".*'
Priority: 3
- Regex: '^<.*'
Priority: 2
SortIncludes: true
......@@ -50,7 +50,8 @@ namespace ngraph
is_match = !predicate || predicate(graph_node);
}
if (is_match) // in case label was already bound this rebinds it to the same node (harmless; and the logic seems cleaner)
if (is_match) // in case label was already bound this rebinds it to the same node
// (harmless; and the logic seems cleaner)
{
auto args = label->get_arguments();
if (args.size() > 0)
......@@ -208,8 +209,8 @@ namespace ngraph
}
// This env var allows one to specify node name patterns to abort pattern matching
// at particular nodes. The upshot is that one can quickly zero in on an offending fusion by
// disabling individual fusions or optimizations that use Matcher.
// at particular nodes. The upshot is that one can quickly zero in on an offending
// fusion by disabling individual fusions or optimizations that use Matcher.
static const char* node_skip_cregex = std::getenv("NGRAPH_FAIL_MATCH_AT");
if (node_skip_cregex)
{
......@@ -298,7 +299,8 @@ namespace ngraph
if (graph_node->is_commutative())
{
// TODO: [nikolayk] we don't really have to use lexicographically-based perms, heap's algo should be faster
// TODO: [nikolayk] we don't really have to use lexicographically-based perms,
// heap's algo should be faster
std::sort(begin(pattern_args),
end(pattern_args),
[](const std::shared_ptr<ngraph::Node>& n1,
......@@ -419,7 +421,8 @@ namespace ngraph
{
if (m.get_pattern_map().count(cor_pat) != 0)
{
// assert that bound nodes from the previous and current matches are the same
// assert that bound nodes from the previous and current matches are the
// same
if (previous_matches.count(cor_pat) != 0)
{
if (previous_matches[cor_pat] != m.get_pattern_map()[cor_pat])
......
......@@ -193,8 +193,10 @@ namespace ngraph
/// repeating patterns (e.g. RNN, LSTM, GRU cells)
///
/// \param pattern is a pattern sub graph describing an individual cell
/// \param rpattern is a (recurring) label to denote which node the next match should start at
/// \param correlated_patterns is a set of labels whose bound nodes must remain the same across all cells
/// \param rpattern is a (recurring) label to denote which node the next match should
/// start at
/// \param correlated_patterns is a set of labels whose bound nodes must remain the same
/// across all cells
RecurrentMatcher(std::shared_ptr<Node> pattern,
std::shared_ptr<op::Label> rpattern,
const std::set<std::shared_ptr<op::Label>>& correlated_patterns)
......
......@@ -29,7 +29,8 @@ namespace ngraph
class Any : public Pattern
{
public:
/// \brief creates a Any node containing a sub-pattern described by \sa type and \sa shape.
/// \brief creates a Any node containing a sub-pattern described by \sa type and \sa
/// shape.
Any(const element::Type& type,
const PartialShape& s,
Predicate pred,
......@@ -43,7 +44,8 @@ namespace ngraph
set_output_type(0, type, s);
}
/// \brief creates a Any node containing a sub-pattern described by the type and shape of \sa node.
/// \brief creates a Any node containing a sub-pattern described by the type and
/// shape of \sa node.
Any(std::shared_ptr<Node> node, Predicate pred, const NodeVector& wrapped_nodes)
: Any(node->get_element_type(),
node->get_output_partial_shape(0),
......
......@@ -35,7 +35,8 @@ namespace ngraph
class AnyOf : public Pattern
{
public:
/// \brief creates a AnyOf node containing a sub-pattern described by \sa type and \sa shape.
/// \brief creates a AnyOf node containing a sub-pattern described by \sa type and
/// \sa shape.
AnyOf(const element::Type& type,
const PartialShape& s,
Predicate pred,
......@@ -54,7 +55,8 @@ namespace ngraph
set_output_type(0, type, s);
}
/// \brief creates a AnyOf node containing a sub-pattern described by the type and shape of \sa node.
/// \brief creates a AnyOf node containing a sub-pattern described by the type and
/// shape of \sa node.
AnyOf(std::shared_ptr<Node> node, Predicate pred, const NodeVector& wrapped_nodes)
: AnyOf(node->get_element_type(),
node->get_output_partial_shape(0),
......
......@@ -31,14 +31,18 @@ namespace ngraph
class Label : public Pattern
{
public:
/// \brief creates a Label node containing a sub-pattern described by \sa type and \sa shape.
/// \brief creates a Label node containing a sub-pattern described by \sa type and
/// \sa shape.
///
/// this Label node can be bound only to the nodes in the input graph
/// that match the pattern specified by \sa wrapped_nodes
/// Example:
/// \code{.cpp}
/// auto add = a + b; // a and b are op::Parameter in this example
/// auto label = std::make_shared<pattern::op::Label>(element::f32, Shape{2,2} , nullptr, NodeVector{add});
/// auto label = std::make_shared<pattern::op::Label>(element::f32,
/// Shape{2,2},
/// nullptr,
/// NodeVector{add});
/// \endcode
Label(const element::Type& type,
const PartialShape& s,
......@@ -49,14 +53,17 @@ namespace ngraph
set_output_type(0, type, s);
}
/// \brief creates a Label node containing a sub-pattern described by the type and shape of \sa node.
/// \brief creates a Label node containing a sub-pattern described by the type and
/// shape of \sa node.
///
/// this Label node can be bound only to the nodes in the input graph
/// that match the pattern specified by \sa wrapped_nodes
/// Example:
/// \code{.cpp}
/// auto add = a + b; // a and b are op::Parameter in this example
/// auto label = std::make_shared<pattern::op::Label>(add, nullptr, NodeVector{add});
/// auto label = std::make_shared<pattern::op::Label>(add,
/// nullptr,
/// NodeVector{add});
/// \endcode
Label(std::shared_ptr<Node> node,
Predicate pred = nullptr,
......
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