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
814554e0
Commit
814554e0
authored
Jul 24, 2019
by
雾雨魔理沙
Committed by
Tianqi Chen
Jul 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init (#3571)
quickfix
parent
5c410037
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
python/tvm/relay/transform.py
+24
-0
src/relay/pass/type_infer.cc
+3
-0
No files found.
python/tvm/relay/transform.py
View file @
814554e0
...
@@ -248,6 +248,30 @@ class Sequential(Pass):
...
@@ -248,6 +248,30 @@ class Sequential(Pass):
passes
,
opt_level
,
name
,
required
)
passes
,
opt_level
,
name
,
required
)
def
infer_type
(
expr
,
mod
=
None
):
"""Infer the type of an expr.
Adding Function into a Module will change it's binding,
and some passes need type inference to work without binding modification.
However, InferType() work by putting stuff into a Module, thus changing all the binding.
This is an escape patch that allow type inference without binding changing.
Parameters
----------
expr : tvm.relay.Expr
The input expression.
mod : Optional[tvm.relay.Module]
The input module
Returns
-------
ret : tvm.relay.Expr
The output expression.
"""
return
_transform
.
infer_type
(
expr
,
mod
)
def
InferType
():
def
InferType
():
"""Infer the type of an expr.
"""Infer the type of an expr.
...
...
src/relay/pass/type_infer.cc
View file @
814554e0
...
@@ -824,6 +824,9 @@ Function InferType(const Function& func,
...
@@ -824,6 +824,9 @@ Function InferType(const Function& func,
return
Downcast
<
Function
>
(
func_ret
);
return
Downcast
<
Function
>
(
func_ret
);
}
}
TVM_REGISTER_API
(
"relay._transform.infer_type"
)
.
set_body_typed
<
Expr
(
Expr
,
Module
)
>
([](
Expr
l
,
Module
r
)
{
return
InferType
(
l
,
r
);
});
namespace
transform
{
namespace
transform
{
Pass
InferType
()
{
Pass
InferType
()
{
...
...
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