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
74ea8e5f
Commit
74ea8e5f
authored
Oct 04, 2018
by
Sergei Grechanik
Committed by
Tianqi Chen
Oct 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TVM] Fix negating undefined in DetectLinearEquation (#1816)
parent
836cf13a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
src/arithmetic/detect_linear_equation.cc
+2
-1
tests/python/unittest/test_arith_detect_linear_equation.py
+4
-0
No files found.
src/arithmetic/detect_linear_equation.cc
View file @
74ea8e5f
...
@@ -111,8 +111,9 @@ class LinearEqDetector
...
@@ -111,8 +111,9 @@ class LinearEqDetector
return
ComputeExpr
<
Add
>
(
a
,
b
);
return
ComputeExpr
<
Add
>
(
a
,
b
);
}
}
Expr
SubCombine
(
Expr
a
,
Expr
b
)
{
Expr
SubCombine
(
Expr
a
,
Expr
b
)
{
if
(
!
a
.
defined
())
return
-
b
;
// Check b first in case they are both undefined
if
(
!
b
.
defined
())
return
a
;
if
(
!
b
.
defined
())
return
a
;
if
(
!
a
.
defined
())
return
-
b
;
return
ComputeExpr
<
Sub
>
(
a
,
b
);
return
ComputeExpr
<
Sub
>
(
a
,
b
);
}
}
Expr
MulCombine
(
Expr
a
,
Expr
b
)
{
Expr
MulCombine
(
Expr
a
,
Expr
b
)
{
...
...
tests/python/unittest/test_arith_detect_linear_equation.py
View file @
74ea8e5f
...
@@ -38,6 +38,10 @@ def test_multivariate():
...
@@ -38,6 +38,10 @@ def test_multivariate():
assert
(
m
[
2
]
.
value
==
2
)
assert
(
m
[
2
]
.
value
==
2
)
assert
(
m
[
len
(
m
)
-
1
]
.
value
==
2
)
assert
(
m
[
len
(
m
)
-
1
]
.
value
==
2
)
m
=
tvm
.
arith
.
DetectLinearEquation
((
v
[
0
]
-
v
[
1
]),
[
v
[
2
]])
assert
(
m
[
0
]
.
value
==
0
)
assert
(
tvm
.
ir_pass
.
Simplify
(
m
[
1
]
-
(
v
[
0
]
-
v
[
1
]))
.
value
==
0
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_basic
()
test_basic
()
test_multivariate
()
test_multivariate
()
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