You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/04/17 05:28:53 UTC
[GitHub] [tvm] wrongtest opened a new pull request, #11032: [TOPI] Fix nn.lrn result dtype on fp16
wrongtest opened a new pull request, #11032:
URL: https://github.com/apache/tvm/pull/11032
The buggy script as below:
```python
import tvm
from tvm import relay
from tvm.contrib import graph_executor
x = relay.var("x", shape=[1, 3, 224, 224], dtype="float32")
y = relay.nn.lrn(x)
mod = tvm.IRModule.from_expr(relay.Function([x], y))
lib = relay.build(mod, target="llvm")
f = graph_executor.GraphModule(lib["default"](tvm.cpu()))
f.run()
```
The error I get is
```
Check failed: ret == 0 (-1 vs. 0) : Assert fail: (((tir.tvm_struct_get(arg.T_divide, 0, 5) == (uint8)2) && (tir.tvm_struct_get(arg.T_divide, 0, 6) == (uint8)32)) && (tir.tvm_struct_get(arg.T_divide, 0, 7) == (uint16)1)), arg.T_divide.dtype is expected to be float32
```
--
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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] wrongtest commented on a diff in pull request #11032: [TOPI] Fix nn.lrn result dtype on fp16
Posted by GitBox <gi...@apache.org>.
wrongtest commented on code in PR #11032:
URL: https://github.com/apache/tvm/pull/11032#discussion_r851790532
##########
tests/python/topi/python/test_topi_lrn.py:
##########
@@ -66,6 +65,7 @@ def test_lrn():
verify_lrn((1, 3, 5, 5), 3, 1, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 20, 20), 3, 1, 2.0, 1.0, 0.75)
+ verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5, dtype="float16", rtol=1e-3, atol=1e-3)
Review Comment:
Yes, It seems that original rtol 1e5 not work with f16. It failed on my machine like
```
Mismatched elements: 4 / 75 (5.33%)
Max absolute difference: 0.000977
Max relative difference: 0.001402
x: array([[[[2.761e-01, 3.909e-01, 2.979e-01, 1.460e-01, 1.453e-01],
[7.842e-01, 7.104e-01, 3.000e-01, 7.490e-01, 5.640e-01],
[1.940e-01, 1.163e-01, 6.709e-01, 1.050e-01, 5.229e-01],...
y: array([[[[2.761e-01, 3.909e-01, 2.979e-01, 1.460e-01, 1.453e-01],
[7.842e-01, 7.100e-01, 3.000e-01, 7.490e-01, 5.640e-01],
[1.940e-01, 1.163e-01, 6.709e-01, 1.050e-01, 5.229e-01],...
```
--
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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] MasterJH5574 commented on a diff in pull request #11032: [TOPI] Fix nn.lrn result dtype on fp16
Posted by GitBox <gi...@apache.org>.
MasterJH5574 commented on code in PR #11032:
URL: https://github.com/apache/tvm/pull/11032#discussion_r851766541
##########
tests/python/topi/python/test_topi_lrn.py:
##########
@@ -66,6 +65,7 @@ def test_lrn():
verify_lrn((1, 3, 5, 5), 3, 1, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 20, 20), 3, 1, 2.0, 1.0, 0.75)
+ verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5, dtype="float16", rtol=1e-3, atol=1e-3)
Review Comment:
Do you mean the 1e-3 tolerance doesn’t work for this set of parameters?
--
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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] MasterJH5574 commented on a diff in pull request #11032: [TOPI] Fix nn.lrn result dtype on fp16
Posted by GitBox <gi...@apache.org>.
MasterJH5574 commented on code in PR #11032:
URL: https://github.com/apache/tvm/pull/11032#discussion_r851817437
##########
tests/python/topi/python/test_topi_lrn.py:
##########
@@ -66,6 +65,7 @@ def test_lrn():
verify_lrn((1, 3, 5, 5), 3, 1, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5)
verify_lrn((1, 3, 20, 20), 3, 1, 2.0, 1.0, 0.75)
+ verify_lrn((1, 3, 5, 5), 3, 3, 1.0, 1.0, 0.5, dtype="float16", rtol=1e-3, atol=1e-3)
Review Comment:
Got it. Thanks for the explanation!
--
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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] junrushao1994 merged pull request #11032: [TOPI] Fix nn.lrn result dtype on fp16
Posted by GitBox <gi...@apache.org>.
junrushao1994 merged PR #11032:
URL: https://github.com/apache/tvm/pull/11032
--
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
For queries about this service, please contact Infrastructure at:
users@infra.apache.org