forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Relay][Op]BroadcastToLike CollapseSumLike (apache#1886)
- Loading branch information
1 parent
cc597ce
commit dc1ed30
Showing
5 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" Support level10 operator test cases. | ||
""" | ||
import tvm | ||
from tvm import relay | ||
|
||
def test_collapse_sum_like(): | ||
x = relay.Var("x", relay.ty.TensorType((3, 4, 5, 6), "int8")) | ||
y = relay.Var("y", relay.ty.TensorType((4, 1, 6), "int8")) | ||
z = relay.collapse_sum_like(x, y) | ||
zz = relay.ir_pass.infer_type(z) | ||
assert zz.checked_type == relay.ty.TensorType((4, 1, 6), "int8") | ||
|
||
|
||
def test_broadcast_to_like(): | ||
x = relay.Var("x", relay.ty.TensorType((3, 4, 5, 6), "int8")) | ||
y = relay.Var("y", relay.ty.TensorType((4, 1, 6), "int8")) | ||
z = relay.broadcast_to_like(y, x) | ||
zz = relay.ir_pass.infer_type(z) | ||
assert zz.checked_type == relay.ty.TensorType((3, 4, 5, 6), "int8") | ||
|
||
if __name__ == "__main__": | ||
test_collapse_sum_like() | ||
test_broadcast_to_like() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters