Lunderberg commented on issue #15148:
URL: https://github.com/apache/tvm/issues/15148#issuecomment-1739257241

   > I see what you're saying--maybe we can add min/max overrides for 
`_test_forward_elemwise_quantized`.
   
   That's what I'm thinking as well.  It looks like it currently uses the same 
range for both quantization and for data generation.  I think it will need to 
override the data generation range to exclude zero from the denominator, but to 
keep zero in the quantization range as zero may occur in the output.
   
   > I'm surprised that `div` and `floor_div` aren't failing in this case 
though, since the rhs can generate 0s :/.
   
   Agreed, as I would expect the same problem to effect any operator with a 
restricted domain.  My guess is that there's some optimization that assumes the 
inputs to be valid (a legal assumption, as the output is typically undefined 
when the denominator is zero), and that that optimization is affecting floormod 
differently from floordiv.  It probably would be good to track that 
optimization down at some point, if it occurs at the TVM level, but I don't 
think that should delay the re-enabling of the unit test.
   
   > May I ask how you're running these tests multiple times?
   
   It's a bit of a hacky way to do so.  I commented out everything in 
`test_all_elemwise` except for the 
`_test_forward_elemwise_quantized(_test_floor_mod)` line, then added a 
parametrized pytest fixture to the file.  When running pytest as usual 
(`python3 -mpytest -sv 
tests/python/frontend/tflite/test_forward.py::test_all_elemwise`), it then 
repeats every test the number of times specified.
   
   ```python
   import pytest
   
   @pytest.fixture(params=list(range(100)), autouse=True)
   def repeat_all_tests(request):
       return request.param
   ```
   
   I suppose I could have just made a for loop, but I was lazy and this let me 
use pytests pass/fail counter instead of making my own :P.


-- 
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]

Reply via email to