khj809 opened a new issue #10636:
URL: https://github.com/apache/tvm/issues/10636
Hi folks,
I'm trying to use `DFPatternRewriteComposer` defined in
`src/relay/transforms/simplify_expr.h` to compose rewrite patterns.
Suppose some of my rewrite patterns get arguments in constructor like this,
```c++
class SimplifyXXX : public DFPatternRewrite {
public:
SimplifyXXX(size_t batch_size_): batch_size(batch_size_) {
...
}
...
private:
size_t batch_size;
...
}
```
and I tried to add this pattern in composer like this,
```c++
size_t batch_size = 1;
DFPatternRewriteComposer composer;
composer.AddRewrite<SimplifyXXX, size_t>(batch_size);
```
then it results in compile error as follows.
```bash
[build] /root/tvm/src/relay/transforms/simplify_expr.h:72:55: error: invalid
conversion from 'long unsigned int*' to 'long unsigned int' [-fpermissive]
[build] 72 | rewrites_.push_back(std::make_shared<T,
Args...>(&args...));
[build] | ^~~~
[build] | |
[build] | long
unsigned int*
```
So I tried to change the code in `src/relay/transforms/simplify_expr.h:72`
like below and there was no error. (Note that `&` was moved from `args` to
`Args`)
```c++
rewrites_.push_back(std::make_shared<T, Args&...>(args...));
```
I'm quite new to tvm and modern C++, so I'm not sure whether my change is
correct. Could you give any opinions about this?
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]