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
1c87e009
Commit
1c87e009
authored
Oct 28, 2018
by
Jared Roesch
Committed by
Tianqi Chen
Oct 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not mutate GlobalVar's checked_type field. (#2026)
parent
32f158e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
src/relay/pass/type_infer.cc
+1
-1
tests/python/relay/test_type_infer.py
+12
-0
No files found.
src/relay/pass/type_infer.cc
View file @
1c87e009
...
...
@@ -366,7 +366,7 @@ class TypeInferencer::Resolver : public ExprMutator {
}
Expr
VisitExpr_
(
const
GlobalVarNode
*
op
)
final
{
return
AttachCheckedType
(
op
);
return
GetRef
<
GlobalVar
>
(
op
);
}
Expr
VisitExpr_
(
const
OpNode
*
op
)
final
{
...
...
tests/python/relay/test_type_infer.py
View file @
1c87e009
...
...
@@ -123,6 +123,16 @@ def test_self_reference():
assert
relay
.
ir_pass
.
infer_type
(
f
)
.
checked_type
==
relay
.
FuncType
([
a
],
a
)
assert
relay
.
ir_pass
.
infer_type
(
fx
)
.
checked_type
==
a
def
test_global_var_cow_issue
():
env
=
relay
.
env
.
Environment
({})
gv
=
relay
.
GlobalVar
(
"foo"
)
x
=
relay
.
var
(
'x'
,
shape
=
[])
func
=
relay
.
Function
([
x
],
relay
.
Call
(
gv
,
[
x
]),
relay
.
TensorType
([],
'float32'
))
env
[
gv
]
=
func
# They should both point to the same global variable if global variables are
# stable across type checking.
assert
gv
==
func
.
body
.
op
if
__name__
==
"__main__"
:
test_free_expr
()
test_dual_op
()
...
...
@@ -134,3 +144,4 @@ if __name__ == "__main__":
test_free_expr
()
test_type_args
()
test_self_reference
()
test_global_var_cow_issue
()
\ No newline at end of file
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