catalyst icon indicating copy to clipboard operation
catalyst copied to clipboard

Some tests fail when tensorflow is imported before catalyst

Open rmoyard opened this issue 2 years ago • 1 comments

The imports

import tensorflow
import catalyst

do not always work, and some tests are failing if tensorflow is imported first. We can see that in when testing the wheels.

FAILED frontend/test/pytest/test_autograph.py::TestConditionals::test_qubit_manipulation_cond[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_conditionals.py::TestCond::test_qubit_manipulation_cond[lightning.qubit]
FAILED frontend/test/pytest/test_jax_integration.py::TestJAXJIT::test_multiple_calls[lightning.qubit]
FAILED frontend/test/pytest/test_mid_circuit_measurement.py::TestMidCircuitMeasurement::test_basic[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_mid_circuit_measurement.py::TestMidCircuitMeasurement::test_more_complex[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_pytree_args.py::TestPyTreesReturnValues::test_return_value_float[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_pytree_args.py::TestPyTreesReturnValues::test_return_value_tuples[lightning.qubit]
FAILED frontend/test/pytest/test_measurements_results.py::TestOtherMeasurements::test_multiple_return_values[lightning.qubit]
FAILED frontend/test/pytest/test_jit_behaviour.py::TestCallsiteCompileVsFunctionDefinitionCompile::test_equivalence[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_jit_behaviour.py::TestDecorator::test_function_is_cached[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_pytree_args.py::TestPyTreesFuncArgs::test_args_used_in_measure[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_jit_behaviour.py::TestCaching::test_function_is_cached[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_pytree_args.py::TestPyTreesFuncArgs::test_args_used_indirectly_in_measure[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_jit_behaviour.py::TestShots::test_shots_in_decorator_in_sample[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_jit_behaviour.py::TestShots::test_shots_in_callsite_in_sample[lightning.qubit]
FAILED frontend/test/pytest/test_qnode.py::test_variable_capture[0-False]
FAILED frontend/test/pytest/test_pytree_args.py::TestPyTreesReturnValues::test_return_value_dict[lightning.qubit]
FAILED frontend/test/pytest/test_loops.py::TestWhileLoops::test_alternating_loop[lightning.qubit]
FAILED frontend/test/pytest/test_conditionals.py::TestCond::test_identical_branch_names[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_contexts.py::TestTracing::test_fixed_tracing[lightning.qubit] - RuntimeError: random_device could not be read
FAILED frontend/test/pytest/test_contexts.py::TestTracing::test_cond_inside_while_loop[lightning.qubit]
FAILED **frontend/test/pytest/test_variable_wires.py::TestBasicCircuits::test_measurements[lightning.qubit-args0]**

rmoyard avatar Oct 03 '23 18:10 rmoyard

I have contributed to the discussion on this ticket after our investigation https://github.com/tensorflow/tensorflow/issues/61741#issuecomment-1749307431

erick-xanadu avatar Oct 05 '23 19:10 erick-xanadu

Looks like this issue has been fixed upstream.

dime10 avatar Jun 24 '24 14:06 dime10