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
8703d9fb
Unverified
Commit
8703d9fb
authored
Jun 17, 2019
by
Tianqi Chen
Committed by
GitHub
Jun 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARITH] Bugfix min/max const canonicalize rule (#3386)
parent
56397826
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
3rdparty/dmlc-core
+1
-1
src/arithmetic/rewrite_simplify.cc
+5
-2
tests/python/unittest/test_arith_rewrite_simplify.py
+2
-0
No files found.
dmlc-core
@
3943914e
Subproject commit
fbe142b267a8edd1f1188fa2140d88f7ae308661
Subproject commit
3943914eed66470bd010df581e29e4dca4f7df6f
src/arithmetic/rewrite_simplify.cc
View file @
8703d9fb
...
...
@@ -813,7 +813,9 @@ Mutate_(const Min* op, const Expr& self) {
// canonicalization
TVM_TRY_RECURSIVE_REWRITE
(
min
(
min
(
x
,
c1
),
y
),
min
(
min
(
x
,
y
),
c1
));
TVM_TRY_RECURSIVE_REWRITE
(
min
(
c1
-
x
,
c2
),
c1
-
max
(
x
,
c2
-
c1
));
TVM_TRY_RECURSIVE_REWRITE_IF
(
min
(
c1
-
x
,
c2
),
c1
-
max
(
x
,
c1
-
c2
),
c2
.
Eval
()
->
value
!=
0
);
}
// condition rules.
...
...
@@ -961,7 +963,8 @@ Mutate_(const Max* op, const Expr& self) {
// canonicalization
TVM_TRY_RECURSIVE_REWRITE
(
max
(
max
(
x
,
c1
),
y
),
max
(
max
(
x
,
y
),
c1
));
TVM_TRY_RECURSIVE_REWRITE
(
max
(
c1
-
x
,
c2
),
c1
-
min
(
x
,
c2
-
c1
));
TVM_TRY_RECURSIVE_REWRITE_IF
(
max
(
c1
-
x
,
c2
),
c1
-
min
(
x
,
c1
-
c2
),
c2
.
Eval
()
->
value
!=
0
);
}
// condition rules.
...
...
tests/python/unittest/test_arith_rewrite_simplify.py
View file @
8703d9fb
...
...
@@ -392,6 +392,7 @@ def test_min_index_simplify():
ck
.
verify
(
tvm
.
min
(
x
/
10
,
y
/
10
),
tvm
.
min
(
x
,
y
)
/
10
)
ck
.
verify
(
tvm
.
min
(
x
/
(
-
10
),
y
/
(
-
10
)),
tvm
.
max
(
x
,
y
)
/
(
-
10
))
ck
.
verify
(
tvm
.
min
(
x
*
3
,
9
),
tvm
.
min
(
x
,
3
)
*
3
)
ck
.
verify
(
tvm
.
min
(
3
-
x
,
2
),
3
-
tvm
.
max
(
x
,
1
))
def
test_max_index_simplify
():
...
...
@@ -448,6 +449,7 @@ def test_max_index_simplify():
ck
.
verify
(
tvm
.
max
(
x
/
10
,
y
/
10
),
tvm
.
max
(
x
,
y
)
/
10
)
ck
.
verify
(
tvm
.
max
(
x
/
(
-
10
),
y
/
(
-
10
)),
tvm
.
min
(
x
,
y
)
/
(
-
10
))
ck
.
verify
(
tvm
.
max
(
x
*
3
,
9
),
tvm
.
max
(
x
,
3
)
*
3
)
ck
.
verify
(
tvm
.
max
(
3
-
x
,
1
),
3
-
tvm
.
min
(
x
,
2
))
def
test_cmp_simplify
():
...
...
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