Hi,
I want to define a custom pattern, and then use the MergeComposite function, but I met some problem.
The pattern I defined is a sequence of nested ops including reshape,add,…My question is that why I got error when passing the is_var pattern to the callback of is_op, but it is fine with wildcard? what’s the difference between this two?
is_op("reshape")(is_var("x"))
and
is_op("reshape")(wildcard())
The latter one works but I want to specify the name_hint of the variable because I want to use it somewhere. But the former one can not pass the transform module.
My full test code is
inp = relay.var('inp', shape=(1,64,512))
r = relay.reshape(inp, [-1,64,512])
test_pattern = is_op("reshape")(is_var("inp"))
assert test_pattern.match(r) # True
pattern_table = [("test", test_pattern)]
mod = tvm.IRModule.from_expr(r)
mod = relay.transform.MergeComposite(pattern_table)(mod)
Error:
mod = relay.transform.MergeComposite(pattern_table)(mod)
File "C:\Anaconda\envs\tvm1\lib\site-packages\tvm-0.7.0-py3.6-win-amd64.egg\tvm\ir\transform.py", line 127, in __call__
return _ffi_transform_api.RunPass(self, mod)
File "C:\Anaconda\envs\tvm1\lib\site-packages\tvm-0.7.0-py3.6-win-amd64.egg\tvm\_ffi\_ctypes\packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
File "C:\Users\t-meli\Documents\t-meli\projects\git-projects\dlis-TVM\TVM_MG\src\relay\ir\dataflow_matcher.cc", line 647
TVMError: Check failed: DFPatternMatcher(body).Match(pattern_, body):
Appreciate for any advice!