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
8f83be7a
Commit
8f83be7a
authored
Jul 27, 2017
by
Tianqi Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATTR/SYMBOL] Expose op_name attr to python (#132)
* [ATTR/SYMBOL] Expose op_name attr to python * fix xcode
parent
7acbbcef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
nnvm/src/core/symbolic.cc
+3
-0
nnvm/tests/python/test_symbol.py
+10
-0
No files found.
nnvm/src/core/symbolic.cc
View file @
8f83be7a
...
...
@@ -473,6 +473,9 @@ bool Symbol::GetAttr(const std::string& key, std::string* out) const {
if
(
key
==
"name"
)
{
*
out
=
node
->
attrs
.
name
;
return
true
;
}
else
if
(
key
==
"op_name"
)
{
*
out
=
node
->
attrs
.
op
->
name
;
return
true
;
}
auto
it
=
node
->
attrs
.
dict
.
find
(
key
);
if
(
it
==
node
->
attrs
.
dict
.
end
())
return
false
;
...
...
nnvm/tests/python/test_symbol.py
View file @
8f83be7a
...
...
@@ -45,6 +45,15 @@ def test_copy():
name
=
'exp'
,
gpu
=
1
,
attr
=
{
"kk"
:
"1"
})
assert
y
.
__copy__
()
.
debug_str
()
==
y
.
debug_str
()
def
test_op_name
():
x
=
sym
.
Variable
(
'x'
)
y
=
sym
.
exp
(
x
)
op_name
=
y
.
attr
(
"op_name"
)
op_func
=
sym
.
__dict__
[
op_name
]
z
=
op_func
(
x
)
def
test_control_dep
():
x
=
sym
.
Variable
(
'x'
)
y
=
sym
.
conv2d
(
data
=
x
,
name
=
'conv'
)
...
...
@@ -53,6 +62,7 @@ def test_control_dep():
t
.
_add_control_deps
([
z
,
y
])
if
__name__
==
"__main__"
:
test_op_name
()
test_copy
()
test_default_input
()
test_compose
()
...
...
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