Commit 22e2307b authored by Robert Kimball's avatar Robert Kimball

update clang-format to sort includes and rerun style

parent 7da5f65e
......@@ -44,3 +44,10 @@ SpacesInSquareBrackets: false
SortIncludes: false
ReflowComments: true
IncludeCategories:
- Regex: '^".*'
Priority: 3
- Regex: '^<.*'
Priority: 2
SortIncludes: true
......@@ -27,7 +27,10 @@ const ngraph::ElementType element_type_uint64_t = ngraph::ElementType(64, false,
std::map<std::string, ngraph::ElementType> ngraph::ElementType::m_element_list;
ngraph::ElementType::ElementType(size_t bitwidth, bool is_float, bool is_signed, const std::string& cname)
ngraph::ElementType::ElementType(size_t bitwidth,
bool is_float,
bool is_signed,
const std::string& cname)
: m_bitwidth{bitwidth}
, m_is_float{is_float}
, m_is_signed{is_signed}
......
......@@ -18,8 +18,8 @@
#pragma once
#include <string>
#include <map>
#include <string>
namespace ngraph
{
......
......@@ -14,12 +14,12 @@
*/
#include <chrono>
#include <condition_variable>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <ctime>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <thread>
#include "log.hpp"
......
......@@ -15,9 +15,9 @@
#pragma once
#include <deque>
#include <sstream>
#include <stdexcept>
#include <deque>
namespace nervana
{
......@@ -37,6 +37,7 @@ namespace nervana
}
constexpr const char* get_ptr(size_t offset) const { return &_string[offset]; }
constexpr size_t size() const { return _size; }
private:
const char* _string;
size_t _size;
......@@ -44,8 +45,9 @@ namespace nervana
constexpr const char* find_last(conststring s, size_t offset, char ch)
{
return offset == 0 ? s.get_ptr(0) : (s[offset] == ch ? s.get_ptr(offset + 1)
: find_last(s, offset - 1, ch));
return offset == 0
? s.get_ptr(0)
: (s[offset] == ch ? s.get_ptr(offset + 1) : find_last(s, offset - 1, ch));
}
constexpr const char* find_last(conststring s, char ch)
......@@ -67,6 +69,7 @@ namespace nervana
~log_helper();
std::ostream& stream() { return _stream; }
private:
std::stringstream _stream;
};
......
......@@ -14,40 +14,39 @@
#pragma once
#include <string>
#include <map>
#include <string>
namespace ngraph
{
//================================================================================================
// NameableValue
// An Axis labels a dimension of a tensor. The op-graph uses
// the identity of Axis objects to pair and specify dimensions in
// symbolic expressions. This system has several advantages over
// using the length and position of the axis as in other frameworks:
//
// 1) Convenience. The dimensions of tensors, which may be nested
// deep in a computation graph, can be specified without having to
// calculate their lengths.
//
// 2) Safety. Axis labels are analogous to types in general-purpose
// programming languages, allowing objects to interact only when
// they are permitted to do so in advance. In symbolic computation,
// this prevents interference between axes that happen to have the
// same lengths but are logically distinct, e.g. if the number of
// training examples and the number of input features are both 50.
//
// TODO: Please add to the list...
//
// Arguments:
// length: The length of the axis.
// batch: Whether the axis is a batch axis.
// recurrent: Whether the axis is a recurrent axis.
//================================================================================================
class NameableValue
{
public:
//================================================================================================
// NameableValue
// An Axis labels a dimension of a tensor. The op-graph uses
// the identity of Axis objects to pair and specify dimensions in
// symbolic expressions. This system has several advantages over
// using the length and position of the axis as in other frameworks:
//
// 1) Convenience. The dimensions of tensors, which may be nested
// deep in a computation graph, can be specified without having to
// calculate their lengths.
//
// 2) Safety. Axis labels are analogous to types in general-purpose
// programming languages, allowing objects to interact only when
// they are permitted to do so in advance. In symbolic computation,
// this prevents interference between axes that happen to have the
// same lengths but are logically distinct, e.g. if the number of
// training examples and the number of input features are both 50.
//
// TODO: Please add to the list...
//
// Arguments:
// length: The length of the axis.
// batch: Whether the axis is a batch axis.
// recurrent: Whether the axis is a recurrent axis.
//================================================================================================
class NameableValue
{
public:
//!-----------------------------------------------------------------------------------
//! NameableValue
//! An object that can be named.
......@@ -103,7 +102,6 @@ public:
std::string m_graph_label;
std::string m_short_name;
std::string m_doc_string;
};
};
} // end namespace ngraph
#include <iostream>
#include <algorithm>
#include <iostream>
#include "strides.hpp"
#include "util.hpp"
......
#pragma once
#include <cstdio>
#include <vector>
#include <initializer_list>
#include <vector>
#include "element_type.hpp"
#include "tree.hpp"
......
#pragma once
#include <algorithm>
#include <functional>
#include <vector>
#include <initializer_list>
#include <iostream>
#include <algorithm>
#include <vector>
#include "util.hpp"
......
......@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <map>
#include <iomanip>
#include <map>
#include "util.hpp"
......
......@@ -14,23 +14,22 @@
#pragma once
#include <string>
#include <sstream>
#include <vector>
#include <chrono>
#include <algorithm>
#include <map>
#include <chrono>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
namespace ngraph
{
class stopwatch;
extern std::map<std::string, stopwatch*> stopwatch_statistics;
class stopwatch;
extern std::map<std::string, stopwatch*> stopwatch_statistics;
template <typename T>
std::string join(const T& v, const std::string& sep)
{
template <typename T>
std::string join(const T& v, const std::string& sep)
{
std::ostringstream ss;
for (const auto& x : v)
{
......@@ -41,11 +40,11 @@ std::string join(const T& v, const std::string& sep)
ss << x;
}
return ss.str();
}
}
template <typename U, typename T>
bool contains(const U& container, const T& obj)
{
template <typename U, typename T>
bool contains(const U& container, const T& obj)
{
bool rc = false;
for (auto o : container)
{
......@@ -56,11 +55,11 @@ bool contains(const U& container, const T& obj)
}
}
return rc;
}
}
template <typename U, typename T>
bool contains_key(const U& container, const T& obj)
{
template <typename U, typename T>
bool contains_key(const U& container, const T& obj)
{
bool rc = false;
for (auto o : container)
{
......@@ -71,28 +70,28 @@ bool contains_key(const U& container, const T& obj)
}
}
return rc;
}
}
template <typename U, typename T>
void remove_from(U& container, const T& obj)
{
template <typename U, typename T>
void remove_from(U& container, const T& obj)
{
auto it = container.find(obj);
if (it != container.end())
{
container.erase(it);
}
}
}
size_t hash_combine(const std::vector<size_t>& list);
void dump(std::ostream& out, const void*, size_t);
size_t hash_combine(const std::vector<size_t>& list);
void dump(std::ostream& out, const void*, size_t);
std::string to_lower(const std::string& s);
std::string trim(const std::string& s);
std::vector<std::string> split(const std::string& s, char delimiter, bool trim = false);
std::string to_lower(const std::string& s);
std::string trim(const std::string& s);
std::vector<std::string> split(const std::string& s, char delimiter, bool trim = false);
class stopwatch
{
public:
class stopwatch
{
public:
stopwatch() {}
stopwatch(const std::string& name)
: m_name{name}
......@@ -150,20 +149,21 @@ public:
size_t get_total_microseconds() const { return get_total_nanoseconds() / 1e3; }
size_t get_total_nanoseconds() const { return m_total_time.count(); }
private:
private:
std::chrono::high_resolution_clock m_clock;
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
bool m_active = false;
std::chrono::nanoseconds m_total_time = std::chrono::high_resolution_clock::duration::zero();
std::chrono::nanoseconds m_total_time =
std::chrono::high_resolution_clock::duration::zero();
std::chrono::nanoseconds m_last_time;
size_t m_total_count = 0;
std::string m_name;
};
};
template <class InputIt, class BinaryOp>
typename std::iterator_traits<InputIt>::value_type
template <class InputIt, class BinaryOp>
typename std::iterator_traits<InputIt>::value_type
reduce(InputIt first, InputIt last, BinaryOp op)
{
{
typename std::iterator_traits<InputIt>::value_type result;
if (first == last)
......@@ -180,18 +180,18 @@ typename std::iterator_traits<InputIt>::value_type
}
}
return result;
}
}
template <typename T>
T plus(const T& a, const T& b)
{
template <typename T>
T plus(const T& a, const T& b)
{
return a + b;
}
}
template <typename T>
T mul(const T& a, const T& b)
{
template <typename T>
T mul(const T& a, const T& b)
{
return a * b;
}
}
} // end namespace ngraph
......@@ -15,10 +15,10 @@
#pragma once
#include <array>
#include <random>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <cstring>
#include <random>
static std::mt19937_64 random_generator;
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <iostream>
#include <chrono>
#include <iostream>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <vector>
#include <string>
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
......
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