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
4b530561
Commit
4b530561
authored
Apr 20, 2019
by
lixiaoquan
Committed by
Tianqi Chen
Apr 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RELAY] Avoid unnecessarily reconstructing FunctionNode. (#3047)
parent
85a3ea08
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/relay/ir/expr_functor.cc
+6
-6
No files found.
src/relay/ir/expr_functor.cc
View file @
4b530561
...
...
@@ -83,27 +83,27 @@ Expr ExprMutator::VisitExpr_(const TupleNode* op) {
Expr
ExprMutator
::
VisitExpr_
(
const
FunctionNode
*
op
)
{
tvm
::
Array
<
TypeVar
>
ty_params
;
bool
all_ty_params_changed
=
true
;
bool
all_ty_params_
un
changed
=
true
;
for
(
auto
ty_param
:
op
->
type_params
)
{
TypeVar
new_ty_param
=
Downcast
<
TypeVar
>
(
VisitType
(
ty_param
));
ty_params
.
push_back
(
new_ty_param
);
all_ty_params_changed
&=
new_ty_param
.
same_as
(
ty_param
);
all_ty_params_
un
changed
&=
new_ty_param
.
same_as
(
ty_param
);
}
tvm
::
Array
<
Var
>
params
;
bool
all_params_changed
=
true
;
bool
all_params_
un
changed
=
true
;
for
(
auto
param
:
op
->
params
)
{
Var
new_param
=
Downcast
<
Var
>
(
this
->
Mutate
(
param
));
params
.
push_back
(
new_param
);
all_params_changed
&=
param
.
same_as
(
new_param
);
all_params_
un
changed
&=
param
.
same_as
(
new_param
);
}
auto
ret_type
=
this
->
VisitType
(
op
->
ret_type
);
auto
body
=
this
->
Mutate
(
op
->
body
);
if
(
ty_params
.
same_as
(
op
->
type_params
)
&&
params
.
same_as
(
op
->
params
)
&&
if
(
all_ty_params_unchanged
&&
all_params_unchanged
&&
ret_type
.
same_as
(
op
->
ret_type
)
&&
body
.
same_as
(
op
->
body
))
{
return
GetRef
<
Expr
>
(
op
);
...
...
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