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
1feabb0d
Commit
1feabb0d
authored
May 26, 2017
by
Eric Junyuan Xie
Committed by
Tianqi Chen
May 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create symbol from nodeattr (#116)
parent
61df4ec5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
nnvm/include/nnvm/symbolic.h
+6
-0
nnvm/src/core/symbolic.cc
+16
-0
No files found.
nnvm/include/nnvm/symbolic.h
View file @
1feabb0d
...
@@ -193,6 +193,12 @@ class Symbol {
...
@@ -193,6 +193,12 @@ class Symbol {
static
Symbol
CreateFunctor
(
const
Op
*
op
,
static
Symbol
CreateFunctor
(
const
Op
*
op
,
std
::
unordered_map
<
std
::
string
,
std
::
string
>
attrs
);
std
::
unordered_map
<
std
::
string
,
std
::
string
>
attrs
);
/*!
/*!
* \brief Create symbolic functor(AtomicSymbol) by given node attributes.
* \param attrs pre-initialized Node attributes.
* \return Symbol that can be used to call compose further.
*/
static
Symbol
CreateFunctor
(
const
NodeAttrs
&
attrs
);
/*!
* \brief Create symbol node representing variable.
* \brief Create symbol node representing variable.
* \param name Name of the variable.
* \param name Name of the variable.
* \return The symbol.
* \return The symbol.
...
...
nnvm/src/core/symbolic.cc
View file @
1feabb0d
...
@@ -527,6 +527,22 @@ Symbol Symbol::CreateFunctor(const Op* op,
...
@@ -527,6 +527,22 @@ Symbol Symbol::CreateFunctor(const Op* op,
return
s
;
return
s
;
}
}
Symbol
Symbol
::
CreateFunctor
(
const
NodeAttrs
&
attrs
)
{
static
auto
&
fnum_vis_output
=
Op
::
GetAttr
<
FNumVisibleOutputs
>
(
"FNumVisibleOutputs"
);
Symbol
s
;
NodePtr
n
=
Node
::
Create
();
n
->
attrs
=
attrs
;
uint32_t
nout
=
n
->
num_outputs
();
if
(
fnum_vis_output
.
count
(
n
->
op
()))
{
nout
=
fnum_vis_output
[
n
->
op
()](
n
->
attrs
);
}
for
(
uint32_t
i
=
0
;
i
<
nout
;
++
i
)
{
s
.
outputs
.
emplace_back
(
NodeEntry
{
n
,
i
,
0
});
}
return
s
;
}
Symbol
Symbol
::
CreateGroup
(
const
std
::
vector
<
Symbol
>
&
symbols
)
{
Symbol
Symbol
::
CreateGroup
(
const
std
::
vector
<
Symbol
>
&
symbols
)
{
Symbol
ret
;
Symbol
ret
;
for
(
const
auto
&
s
:
symbols
)
{
for
(
const
auto
&
s
:
symbols
)
{
...
...
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