Cookiee235 commented on issue #17175:
URL: https://github.com/apache/tvm/issues/17175#issuecomment-2339437332
@yongwww Thanks for your reply. Indeed, In some common cases, LegalizeOps
can solve the problem in `relax.add`. But for some specialized cases,
LegalizeOps is helpless. One such case is shown below. Can you help review it?
Thanks a lot!
```
import tvm
from tvm import relax
from tvm.script import ir as I
from tvm.script import relax as R
@I.ir_module
class Module:
@R.function
def main_7(t: R.Tuple(R.Tensor, R.Tensor)) -> R.Tensor:
x: R.Tensor = t[0]
y: R.Tensor = t[1]
z: R.Tensor = R.add(x, y)
w: R.Tensor = R.multiply(z, z)
return w
mod = Module
mod = relax.transform.LegalizeOps()(mod)
ex = relax.build(mod, target='llvm')import tvm
from tvm import relax
from tvm.script import ir as I
from tvm.script import relax as R
@I.ir_module
class Module:
@R.function
def main_7(t: R.Tuple(R.Tensor, R.Tensor)) -> R.Tensor:
x: R.Tensor = t[0]
y: R.Tensor = t[1]
z: R.Tensor = R.add(x, y)
w: R.Tensor = R.multiply(z, z)
return w
mod = Module
mod = relax.transform.LegalizeOps()(mod)
ex = relax.build(mod, target='llvm')
```
--
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]