Skip to content

Commit

Permalink
Support creating Bool constants in the pattern_utils (#7507)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Brookhart committed Feb 24, 2021
1 parent 9c5333e commit 88a4fdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/relay/transforms/pattern_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ namespace relay {
} else if (type == DataType::UInt(8)) { \
typedef uint8_t DType; \
{ __VA_ARGS__ } \
} else if (type == DataType::Bool()) { \
typedef bool DType; \
{ __VA_ARGS__ } \
} else if ((*tvm::runtime::Registry::Get("runtime._datatype_get_type_registered"))( \
static_cast<uint8_t>(type.code()))) { \
typedef double DType; \
Expand Down
2 changes: 1 addition & 1 deletion tests/python/relay/test_pass_simplify_expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def after_right(x, elem_op, value):
assert tvm.ir.structural_equal(zz, after)

for shape in [[10], [10, 10], [10, 10, 10]]:
for dtype in ["float32", "int32"]:
for dtype in ["float32", "int32", "bool"]:
for value in [0, 1, 2]:
validate(shape, value, dtype)

Expand Down

0 comments on commit 88a4fdd

Please sign in to comment.