comaniac commented on a change in pull request #6052:
URL: https://github.com/apache/incubator-tvm/pull/6052#discussion_r454650764
##########
File path: python/tvm/relay/dataflow_pattern/__init__.py
##########
@@ -748,11 +756,14 @@ def rewrite(callbacks, expr: Expr) -> Expr:
The Expression with matched subgraphs rewritten by the callbacks.
"""
if isinstance(callbacks, DFPatternCallback):
- tmp = [_DFPatternCallback(callbacks.pattern, callbacks.callback)]
+ assert callbacks.pattern is not None
+ tmp = [_DFPatternCallback(callbacks.pattern, callbacks.callback,
callbacks.require_type)]
else:
tmp = []
for callback in callbacks:
- tmp.append(_DFPatternCallback(callback.pattern, callback.callback))
+ assert callback.pattern is not None
+ tmp.append(_DFPatternCallback(callback.pattern, callback.callback,
+ callback.require_type))
Review comment:
We can simplify this part by adding
`callbacks = [callbacks] if instance(callbacks, DFPatternCallback) else
callback`
on the top.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]