altanh commented on a change in pull request #7731:
URL: https://github.com/apache/tvm/pull/7731#discussion_r600683869
##########
File path: src/relay/transforms/simplify_expr.cc
##########
@@ -22,44 +22,37 @@
* \brief A pass for simplifying the Relay expression.
*/
+#include "simplify_expr.h"
+
#include <tvm/relay/dataflow_matcher.h>
#include <tvm/relay/expr.h>
#include <tvm/relay/expr_functor.h>
#include <tvm/relay/transform.h>
#include <tvm/runtime/logging.h>
+#include <utility>
+
#include "../op/tensor/transform.h"
#include "pattern_utils.h"
namespace tvm {
namespace relay {
-class SimplifyPattern {
- public:
- virtual Expr callback(const Expr& pre, const Expr& post,
- const Map<DFPattern, Array<Expr>>& node_map) const = 0;
-
- DFPattern pattern() const { return pattern_; }
-
- protected:
- /*! \brief Pattern for rewriting */
- DFPattern pattern_;
-};
-
/*!
* \brief SimplifyReshape matches the pattern of consecutive reshape or
reverse_reshape ops,
* and merges into one reshape op.
*/
-class SimplifyReshape : public SimplifyPattern {
+class SimplifyReshape : public DFPatternRewrite {
public:
SimplifyReshape() {
x_ = IsWildcard();
auto reshape1 = IsOp("reshape") || IsOp("contrib_reverse_reshape");
auto reshape2 = IsOp("reshape") || IsOp("contrib_reverse_reshape");
pattern_ = reshape1({reshape2({x_})});
+ require_type_ = true;
Review comment:
good point, thanks
--
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]