Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
22e2307b
Commit
22e2307b
authored
Aug 16, 2017
by
Robert Kimball
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update clang-format to sort includes and rerun style
parent
7da5f65e
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
125 additions
and
114 deletions
+125
-114
.clang-format
.clang-format
+7
-0
element_type.cpp
src/element_type.cpp
+4
-1
element_type.hpp
src/element_type.hpp
+1
-1
log.cpp
src/log.cpp
+3
-3
log.hpp
src/log.hpp
+6
-3
names.hpp
src/names.hpp
+30
-32
strides.cpp
src/strides.cpp
+1
-1
strides.hpp
src/strides.hpp
+1
-1
tree.hpp
src/tree.hpp
+2
-2
util.cpp
src/util.cpp
+1
-1
util.hpp
src/util.hpp
+47
-47
uuid.hpp
src/uuid.hpp
+2
-2
axes.cpp
test/axes.cpp
+2
-2
element_type.cpp
test/element_type.cpp
+2
-2
exop.cpp
test/exop.cpp
+2
-2
main.cpp
test/main.cpp
+1
-1
names.cpp
test/names.cpp
+2
-2
op_graph.cpp
test/op_graph.cpp
+2
-2
strides.cpp
test/strides.cpp
+2
-2
tensor.cpp
test/tensor.cpp
+3
-3
util.cpp
test/util.cpp
+2
-2
uuid.cpp
test/uuid.cpp
+2
-2
No files found.
.clang-format
View file @
22e2307b
...
...
@@ -44,3 +44,10 @@ SpacesInSquareBrackets: false
SortIncludes: false
ReflowComments: true
IncludeCategories:
- Regex: '^".*'
Priority: 3
- Regex: '^<.*'
Priority: 2
SortIncludes: true
src/element_type.cpp
View file @
22e2307b
...
...
@@ -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
}
...
...
src/element_type.hpp
View file @
22e2307b
...
...
@@ -18,8 +18,8 @@
#pragma once
#include <string>
#include <map>
#include <string>
namespace
ngraph
{
...
...
src/log.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
src/log.hpp
View file @
22e2307b
...
...
@@ -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
;
};
...
...
src/names.hpp
View file @
22e2307b
...
...
@@ -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
src/strides.cpp
View file @
22e2307b
#include <iostream>
#include <algorithm>
#include <iostream>
#include "strides.hpp"
#include "util.hpp"
...
...
src/strides.hpp
View file @
22e2307b
#pragma once
#include <cstdio>
#include <vector>
#include <initializer_list>
#include <vector>
#include "element_type.hpp"
#include "tree.hpp"
...
...
src/tree.hpp
View file @
22e2307b
#pragma once
#include <algorithm>
#include <functional>
#include <vector>
#include <initializer_list>
#include <iostream>
#include <
algorithm
>
#include <
vector
>
#include "util.hpp"
...
...
src/util.cpp
View file @
22e2307b
...
...
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <map>
#include <iomanip>
#include <map>
#include "util.hpp"
...
...
src/util.hpp
View file @
22e2307b
...
...
@@ -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
src/uuid.hpp
View file @
22e2307b
...
...
@@ -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
;
...
...
test/axes.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/element_type.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/exop.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/main.cpp
View file @
22e2307b
...
...
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// ----------------------------------------------------------------------------
#include <iostream>
#include <chrono>
#include <iostream>
#include "gtest/gtest.h"
...
...
test/names.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/op_graph.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/strides.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/tensor.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/util.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
test/uuid.cpp
View file @
22e2307b
...
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment