PennyLaneAI / catalyst

A JIT compiler for hybrid quantum programs in PennyLane
https://docs.pennylane.ai/projects/catalyst
Apache License 2.0
129 stars 29 forks source link

Some tests fail when tensorflow is imported before catalyst #299

Closed rmoyard closed 3 months ago

rmoyard commented 12 months ago

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]**
erick-xanadu commented 11 months ago

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

dime10 commented 3 months ago

Looks like this issue has been fixed upstream.