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
4b827593
Commit
4b827593
authored
Sep 02, 2019
by
雾雨魔理沙
Committed by
Wuwei Lin
Sep 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Relay] [Parser] fix parser for cast. (#3873)
* fix * lint
parent
60de5be1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletions
+18
-1
python/tvm/relay/_parser.py
+3
-1
tests/python/relay/test_ir_text_printer.py
+15
-0
No files found.
python/tvm/relay/_parser.py
View file @
4b827593
...
...
@@ -77,7 +77,8 @@ class ExprOp(OpWrapper):
try
:
return
expr
.
Call
(
self
.
operator
,
args
,
attrs
,
type_args
)
except
Exception
:
raise
Exception
(
str
(
self
.
operator
)
+
" "
+
str
(
attrs
))
raise
Exception
(
"Operator {} is not registered. It's attributes are {}"
.
format
(
self
.
operator
,
attrs
))
class
FuncOp
(
OpWrapper
):
"""Convert the attrs, call the python function with the attrs passed in as keyword arguments.
...
...
@@ -132,6 +133,7 @@ FUNC_OPS = {
"nn.dropout"
:
op
.
nn
.
dropout_raw
,
"zeros"
:
op
.
zeros
,
"split"
:
op
.
split
,
"cast"
:
op
.
cast
}
TYPE_PREFIXES
=
[
...
...
tests/python/relay/test_ir_text_printer.py
View file @
4b827593
...
...
@@ -169,19 +169,23 @@ def test_inception_v3():
net
,
params
=
tvm
.
relay
.
testing
.
inception_v3
.
get_workload
(
batch_size
=
1
)
astext
(
net
)
def
test_squeezenet
():
for
version
in
[
'1.0'
,
'1.1'
]:
net
,
params
=
tvm
.
relay
.
testing
.
squeezenet
.
get_workload
(
batch_size
=
1
,
version
=
version
)
astext
(
net
)
def
test_vgg
():
net
,
params
=
tvm
.
relay
.
testing
.
vgg
.
get_workload
(
batch_size
=
1
)
astext
(
net
)
def
test_densenet
():
net
,
params
=
tvm
.
relay
.
testing
.
densenet
.
get_workload
(
batch_size
=
1
)
astext
(
net
)
def
test_call_node_order
():
x
=
relay
.
var
(
"x"
)
y
=
relay
.
var
(
"y"
)
...
...
@@ -196,6 +200,7 @@ def test_call_node_order():
"};
\n
"
"
%2
(
%1
)"
)
def
test_let_inlining
():
tup
=
relay
.
Tuple
([
relay
.
const
(
0
),
relay
.
const
(
0
)])
x
=
relay
.
var
(
"x"
)
...
...
@@ -208,10 +213,19 @@ def test_let_inlining():
(
"let
%
x = (0, 0);
\n
"
"
%
x"
)
def
test_zeros
():
x
=
relay
.
op
.
zeros
([],
"float32"
)
astext
(
x
)
def
test_cast
():
data
=
relay
.
var
(
'data'
,
dtype
=
'float32'
)
fp16_cast
=
relay
.
cast
(
data
,
dtype
=
'float16'
)
cast_func
=
relay
.
Function
(
relay
.
analysis
.
free_vars
(
fp16_cast
),
fp16_cast
)
astext
(
cast_func
)
if
__name__
==
"__main__"
:
do_print
[
0
]
=
True
test_lstm
()
...
...
@@ -233,3 +247,4 @@ if __name__ == "__main__":
test_let_if_scope
()
test_variable_name
()
test_call_node_order
()
test_cast
()
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