Commit 802bca81 authored by Adam Procter's avatar Adam Procter Committed by Scott Cyphers

Add .clang-format with comment wrap to src/ngraph (#3461)

* 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.
parent 3d8eb6b7
#
# OVERRIDE TO STYLE: Comments 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
...@@ -168,7 +168,7 @@ void autodiff::Adjoints::add_delta(const Output<Node>& x, ...@@ -168,7 +168,7 @@ void autodiff::Adjoints::add_delta(const Output<Node>& x,
} }
} }
//This doesn't need an index since slice can only sit on top of GOE // This doesn't need an index since slice can only sit on top of GOE
void autodiff::Adjoints::add_delta_to_slice(const Output<Node>& x, void autodiff::Adjoints::add_delta_to_slice(const Output<Node>& x,
const Output<Node>& delta, const Output<Node>& delta,
const Coordinate& lower_bounds, const Coordinate& lower_bounds,
......
#
# 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
...@@ -216,7 +216,8 @@ void codegen::CompilerCore::initialize() ...@@ -216,7 +216,8 @@ void codegen::CompilerCore::initialize()
{ {
diag_consumer = new IgnoringDiagConsumer(); diag_consumer = new IgnoringDiagConsumer();
} }
// Create diagnostics after compiler invocation is created, otherwise report outputs do not get generated. // Create diagnostics after compiler invocation is created, otherwise report outputs do not get
// generated.
m_compiler->createDiagnostics(diag_consumer); m_compiler->createDiagnostics(diag_consumer);
configure_search_path(); configure_search_path();
......
...@@ -66,9 +66,9 @@ CoordinateTransform::CoordinateTransform(const Shape& source_shape, ...@@ -66,9 +66,9 @@ CoordinateTransform::CoordinateTransform(const Shape& source_shape,
} }
if (m_n_axes != source_axis_order.size()) if (m_n_axes != source_axis_order.size())
{ {
// Note: this check is NOT redundant with the is_permutation check below, though you might think it is. // Note: this check is NOT redundant with the is_permutation check below, though you might
// If the lengths don't match then is_permutation won't catch that; it'll either stop short or walk off // think it is. If the lengths don't match then is_permutation won't catch that; it'll
// the end of source_axis_order. // either stop short or walk off the end of source_axis_order.
throw std::domain_error( throw std::domain_error(
"Source axis order does not have the same number of axes as the source space shape"); "Source axis order does not have the same number of axes as the source space shape");
} }
...@@ -321,8 +321,8 @@ Coordinate CoordinateTransform::to_source_coordinate(const Coordinate& c_target) ...@@ -321,8 +321,8 @@ Coordinate CoordinateTransform::to_source_coordinate(const Coordinate& c_target)
return c_source; return c_source;
} }
// A point in the target space is considered not to have a source coordinate if it was inserted due to // A point in the target space is considered not to have a source coordinate if it was inserted due
// padding or dilation, or if it is out of the bounds of the target space. // to padding or dilation, or if it is out of the bounds of the target space.
bool CoordinateTransform::has_source_coordinate(const Coordinate& c_target) const bool CoordinateTransform::has_source_coordinate(const Coordinate& c_target) const
{ {
if (c_target.size() != m_n_axes) if (c_target.size() != m_n_axes)
...@@ -402,7 +402,8 @@ CoordinateTransform::Iterator::Iterator(const Shape& target_shape, bool is_end) ...@@ -402,7 +402,8 @@ CoordinateTransform::Iterator::Iterator(const Shape& target_shape, bool is_end)
void CoordinateTransform::Iterator::operator++() void CoordinateTransform::Iterator::operator++()
{ {
// If we are out of bounds, start over at (0,...0). (TODO: not sure if that's what we want. It might be best to stay put?) // If we are out of bounds, start over at (0,...0). (TODO: not sure if that's what we want. It
// might be best to stay put?)
if (m_oob) if (m_oob)
{ {
std::fill(m_coordinate.begin(), m_coordinate.end(), 0); std::fill(m_coordinate.begin(), m_coordinate.end(), 0);
...@@ -426,7 +427,8 @@ void CoordinateTransform::Iterator::operator++() ...@@ -426,7 +427,8 @@ void CoordinateTransform::Iterator::operator++()
} }
} }
// If we are still here there was carry-out from the most significant axis. We are now out of bounds. // If we are still here there was carry-out from the most significant axis. We are now out of
// bounds.
m_oob = true; m_oob = true;
} }
......
#
# 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
#
# 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
...@@ -82,7 +82,8 @@ namespace ngraph ...@@ -82,7 +82,8 @@ namespace ngraph
const std::string& get_name() const; const std::string& get_name() const;
/// \brief Sets a friendly name for a function. This does not overwrite the unique name /// \brief Sets a friendly name for a function. This does not overwrite the unique name
/// of the function and is retrieved via get_friendly_name(). Used mainly for debugging. /// of the function and is retrieved via get_friendly_name(). Used mainly for
/// debugging.
/// The friendly name may be set exactly once. /// The friendly name may be set exactly once.
/// \param name is the friendly name to set /// \param name is the friendly name to set
void set_friendly_name(const std::string& name); void set_friendly_name(const std::string& name);
......
...@@ -390,7 +390,8 @@ namespace ngraph ...@@ -390,7 +390,8 @@ namespace ngraph
bool ignore_unused = false, bool ignore_unused = false,
bool ignore_output_duplicates = true); bool ignore_output_duplicates = true);
// Extract sub-graph computing the `results`. Stops backward traversal at either a Parameter node // Extract sub-graph computing the `results`. Stops backward traversal at either a Parameter
// node
// or a node that belongs to args // or a node that belongs to args
NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args); NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args);
......
...@@ -67,7 +67,8 @@ Node::~Node() ...@@ -67,7 +67,8 @@ Node::~Node()
{ {
if (input.has_output()) if (input.has_output())
{ {
// This test adds 1 to the actual count, so a count of 2 means this input is the only reference to the node. // This test adds 1 to the actual count, so a count of 2 means this input is the only
// reference to the node.
if (input.get_output().get_node().use_count() == 2) if (input.get_output().get_node().use_count() == 2)
{ {
// Don't want to trigger a deep recursive delete // Don't want to trigger a deep recursive delete
...@@ -122,7 +123,8 @@ void Node::safe_delete(NodeVector& nodes, bool recurse) ...@@ -122,7 +123,8 @@ void Node::safe_delete(NodeVector& nodes, bool recurse)
{ {
if (input.has_output()) if (input.has_output())
{ {
// This test adds 1 to the actual count, so a count of 2 means this input is the only reference to the node. // This test adds 1 to the actual count, so a count of 2 means this input is the only
// reference to the node.
auto node = input.get_output().get_node(); auto node = input.get_output().get_node();
if (node.use_count() == 2) if (node.use_count() == 2)
{ {
......
...@@ -132,7 +132,8 @@ namespace ngraph ...@@ -132,7 +132,8 @@ namespace ngraph
Node(const NodeVector& arguments, size_t output_size = 1); Node(const NodeVector& arguments, size_t output_size = 1);
virtual void generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas) {} virtual void generate_adjoints(autodiff::Adjoints& adjoints, const NodeVector& deltas) {}
/// \brief Moves nodes that would be deleted from inputs to nodes to avoid stack overflows on deep networks. /// \brief Moves nodes that would be deleted from inputs to nodes to avoid stack overflows
/// on deep networks.
void safe_delete(NodeVector& nodes, bool recurse); void safe_delete(NodeVector& nodes, bool recurse);
public: public:
......
#
# 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
#
# 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
#
# 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
#
# 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
...@@ -59,7 +59,8 @@ namespace ngraph ...@@ -59,7 +59,8 @@ namespace ngraph
template <> template <>
PartialShape reduce(const PartialShape& shape, const AxisSet& deleted_axes); PartialShape reduce(const PartialShape& shape, const AxisSet& deleted_axes);
// TODO: check validity, i.e. that the new axis indices are all < axis_values.size()+num_new_axes. // TODO: check validity, i.e. that the new axis indices are all less than
// axis_values.size()+num_new_axes.
// Add new values at particular axis positions // Add new values at particular axis positions
template <typename AXIS_VALUES, typename AXIS_VALUE> template <typename AXIS_VALUES, typename AXIS_VALUE>
AXIS_VALUES inject_pairs(const AXIS_VALUES& axis_values, AXIS_VALUES inject_pairs(const AXIS_VALUES& axis_values,
......
#
# 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
...@@ -506,7 +506,8 @@ static std::tuple<element::Type, PartialShape, PartialShape> infer_batch_norm_fo ...@@ -506,7 +506,8 @@ static std::tuple<element::Type, PartialShape, PartialShape> infer_batch_norm_fo
channel_dim = input_shape[1]; channel_dim = input_shape[1];
} }
// Infer gamma/beta/mu/sigma shape, which must be consistent with a vector of size "channel_dim". // Infer gamma/beta/mu/sigma shape, which must be consistent with a vector of size
// "channel_dim".
PartialShape channel_shape{PartialShape::dynamic()}; PartialShape channel_shape{PartialShape::dynamic()};
for (auto& inp : channel_shaped_inputs) for (auto& inp : channel_shaped_inputs)
......
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