Assert based dynamo tests fail on Python 3.9: test_rewrite_assert_with_msg test_rewrite_assert_without_msg
See original GitHub issue🐛 Describe the bug
===================================== short test summary info =====================================
FAILED test/dynamo/test_dynamic_shapes.py::DynamicShapesReproTests::test_rewrite_assert_with_msg_dynamic_shapes - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_dynamic_shapes.py::DynamicShapesReproTests::test_rewrite_assert_without_msg_dynamic_shapes - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_no_fake_tensors.py::NoFakeTensorsReproTests::test_rewrite_assert_with_msg_no_fake_tensors - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_no_fake_tensors.py::NoFakeTensorsReproTests::test_rewrite_assert_without_msg_no_fake_tensors - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_repros.py::ReproTests::test_rewrite_assert_with_msg - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_repros.py::ReproTests::test_rewrite_assert_without_msg - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_unspec.py::UnspecReproTests::test_batch_norm_act_unspec
FAILED test/dynamo/test_unspec.py::UnspecReproTests::test_rewrite_assert_with_msg_unspec - torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
FAILED test/dynamo/test_unspec.py::UnspecReproTests::test_re
typical backtrace
File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 404, in _compile
out_code = transform_code_object(code, transform)
File "/data/users/ezyang/a/pytorch/torch/_dynamo/bytecode_transformation.py", line 341, in transf
orm_code_object
transformations(instructions, code_options)
File "/data/users/ezyang/a/pytorch/torch/_dynamo/convert_frame.py", line 392, in transform
tracer.run()
File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 1624, in run
super().run()
File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 490, in run
and self.step()
File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 460, in step
getattr(self, inst.opname)(inst)
File "/data/users/ezyang/a/pytorch/torch/_dynamo/symbolic_convert.py", line 272, in inner unimplemented(f"generic_jump {typestr(value)}")
File "/data/users/ezyang/a/pytorch/torch/_dynamo/exc.py", line 67, in unimplemented raise Unsupported(msg)
torch._dynamo.exc.Unsupported: generic_jump TensorVariable()
Error logs
No response
Minified repro
No response
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
unittest — Unit testing framework — Python 3.11.1 ...
This naming convention informs the test runner about which methods represent tests. The crux of each test is a call to assertEqual() to...
Read more >test_bdb and test_distutils fail on installed Python 3.9, 3.10 ...
test_bdb and test_distutils fail on installed Python 3.9, 3.10 and 3.11 ... Based on this finding, I don't think there's anything that Setuptools...
Read more >Python pytest mock fails with "assert None" for function call ...
The dynamo DB object is a global variable. So when the expected and actual inputs differ then it fails because of this, however...
Read more >Assertion Tests | AWS CDK Workshop
Fine-Grained Assertion Tests # Create a test for the DynamoDB table # This section ... platform linux -- Python 3.9.6, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 ......
Read more >Python's assert: Debug and Test Your Code Like a Pro
The assert statement takes care of raising this exception when the assertion condition fails. Additionally, you shouldn't attempt to handle ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s nice sleuthing! It sounds to me like users may run into this in real code, so we should be able to analyze the pytest assert? Or maybe this only matters for export so whatever, we just need to turn off the pytest rewriting here.
I saw this in fbcode and just turned off the pytest assert rewrite in fbcode as we don’t care about this in export. Maybe we can just turn off pytest assert rewrite? Because in other cases, my assert rewrite condition will fail anyways. The reason you see this error is because my assert rewrite wasn’t able to detect the assert statement so it was a no-op.