Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
b63cb4d1
Commit
b63cb4d1
authored
Jul 14, 2016
by
Tianqi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce NodePtr (#9)
parent
ea8d2292
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
8 deletions
+6
-8
nnvm/include/nnvm/base.h
+1
-0
nnvm/include/nnvm/graph.h
+1
-1
nnvm/include/nnvm/node.h
+1
-2
nnvm/src/core/graph_attr_types.cc
+1
-1
nnvm/src/core/node.cc
+1
-3
nnvm/src/test_main.cc
+1
-1
No files found.
nnvm/include/nnvm/base.h
View file @
b63cb4d1
...
...
@@ -8,6 +8,7 @@
#include <dmlc/base.h>
#include <dmlc/any.h>
#include <dmlc/memory.h>
#include <dmlc/logging.h>
#include <dmlc/registry.h>
#include <dmlc/array_view.h>
...
...
nnvm/include/nnvm/graph.h
View file @
b63cb4d1
...
...
@@ -81,7 +81,7 @@ void PostOrderDFSVisit(const std::vector<GNode>& heads,
template
<
typename
FVisit
>
inline
void
DFSVisit
(
const
std
::
vector
<
NodeEntry
>&
heads
,
FVisit
fvisit
)
{
typedef
const
std
::
shared_ptr
<
Node
>
*
GNode
;
typedef
const
NodePtr
*
GNode
;
std
::
vector
<
GNode
>
head_nodes
(
heads
.
size
());
std
::
transform
(
heads
.
begin
(),
heads
.
end
(),
head_nodes
.
begin
(),
[](
const
NodeEntry
&
e
)
->
GNode
{
...
...
nnvm/include/nnvm/node.h
View file @
b63cb4d1
...
...
@@ -20,8 +20,7 @@ class Node;
/*!
* \brief we always used NodePtr for a reference pointer
* to the node, so this alias can be changed in case we need
* even faster graph composition than 3M ops/sec.
* to the node, so this alias can be changed in case.
*
* By default, NodePtr is a std::shared_ptr of node
*/
...
...
nnvm/src/core/graph_attr_types.cc
View file @
b63cb4d1
...
...
@@ -14,7 +14,7 @@ IndexedGraph::IndexedGraph(const Graph &g) {
std
::
vector
<
size_t
>
inputs_rptr
{
0
},
control_rptr
{
0
};
DFSVisit
(
g
.
outputs
,
[
this
,
&
inputs_rptr
,
&
control_rptr
]
(
const
std
::
shared_ptr
<
nnvm
::
Node
>
&
n
)
{
(
const
NodePtr
&
n
)
{
CHECK_LT
(
nodes_
.
size
(),
std
::
numeric_limits
<
uint32_t
>::
max
());
uint32_t
nid
=
static_cast
<
uint32_t
>
(
nodes_
.
size
());
// nodes_
...
...
nnvm/src/core/node.cc
View file @
b63cb4d1
...
...
@@ -12,7 +12,7 @@ Node::~Node() {
// explicit deletion via DFS
// this is used to avoid stackoverflow caused by chain of deletions
std
::
vector
<
Node
*>
stack
{
this
};
std
::
vector
<
std
::
shared_ptr
<
Node
>
>
to_delete
;
std
::
vector
<
NodePtr
>
to_delete
;
while
(
!
stack
.
empty
())
{
Node
*
n
=
stack
.
back
();
stack
.
pop_back
();
...
...
@@ -37,8 +37,6 @@ Node::~Node() {
}
NodePtr
Node
::
Create
()
{
// NOTE: possible change to thread local memory pool
// via std::allocate_shared instead for faster allocation.
return
std
::
make_shared
<
Node
>
();
}
...
...
nnvm/src/test_main.cc
View file @
b63cb4d1
...
...
@@ -35,7 +35,7 @@ void test_node_speed() {
auto
add
=
nnvm
::
Op
::
Get
(
"add"
);
double
tstart
=
dmlc
::
GetTime
();
size_t
rep
=
1000
;
size_t
n
=
100
;
size_t
n
=
100
0
;
for
(
size_t
t
=
0
;
t
<
rep
;
++
t
)
{
nnvm
::
Symbol
s
=
nnvm
::
Symbol
::
CreateVariable
(
"x"
);
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
{
...
...
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