You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "Jupiterghy (via GitHub)" <gi...@apache.org> on 2024/03/29 04:29:08 UTC
[I] [Bug] Inconsistent Transformation Results in TVM's DivToMul Optimization [tvm]
Jupiterghy opened a new issue, #16819:
URL: https://github.com/apache/tvm/issues/16819
I have encountered an issue while using the relay.transform.DivToMul() optimization in TVM. I don’t know why there exists an inconsistency. I think the two methods should yield the same result while actually not.
### Expected behavior
The modules after transformation should be structural equal.
### Actual behavior
The two transformed modules (module and module_once) are not structurally equal.
### Environment
- Operating System: Ubuntu 18.04.5
- TVM version: 0.15.dev0
- ONNX: 1.15.0
### Steps to reproduce
1. Download the [ONNX model](https://github.com/Jupiterghy/onnx_model/blob/main/1.onnx)
2. Execute the script:
```python
import onnx
import tvm
from tvm import relay
def apply_optimizations(module, opt, num_iterations=1):
for _ in range(num_iterations):
module = opt(module)
return module
if __name__ == "__main__":
onnx_file = "model.onnx"
onnx_model = onnx.load(onnx_file)
shape_dict = {'v25_0': [1, 1, 1], 'v4_0': [12, 2, 45, 1, 1], 'v19_0': [12, 1, 45, 1, 1], 'v15_0': [12, 1, 45, 1, 1], 'v14_0': [12, 52, 45, 1, 1]}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict, freeze_params=True)
opt = relay.transform.DivToMul()
module = opt(mod)
module_once = apply_optimizations(mod, opt, num_iterations=1)
assert tvm.ir.structural_equal(module, module_once)
```
### Triage
* needs-triage
--
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: commits-unsubscribe@tvm.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org