tensorflow / quantum

Hybrid Quantum-Classical Machine Learning in TensorFlow
https://www.tensorflow.org/quantum
Apache License 2.0
1.77k stars 558 forks source link

Error in tfq_simulate_ops #762

Open VishuKalier2003 opened 1 year ago

VishuKalier2003 commented 1 year ago

I tried to open and extract the files using tfq_simulate_ops but it didnt work. Can someone please provide me with more insights.

lockwo commented 1 year ago

What are you trying to do that you are encountering this? Install from source ?

QuantumJaeYoo commented 1 year ago

Could you please guide us where the error happens?

jaeyoo commented 1 year ago

Hi @VishuKalier2003 ,

I installed tensorflow quantum from scratch based on the newly updated https://github.com/jaeyoo/quantum/blob/master/docs/install.md#4-build-tensorflow-from-source. Please pay attention to the TF build line with the explanations:

Build the TensorFlow package (Since TF v2.8, _GLIBCXX_USE_CXX11_ABI is set to 1, and the c++ codes are all compiled with -std=c++17):

Because we are bumping up to TF v2.11.0, your old TF with ABI=0 will give you the error message like tfq_simulate_ops load_library failure.

Please, please rebuild TF and install it in your "NEW" python venv from scratch.

  bazel build -c opt --cxxopt="-O3" --cxxopt="-march=native" --cxxopt="-std=c++17" --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1" //tensorflow/tools/pip_package:build_pip_package

As you can see, ABI is changed from 0 to 1, and std is upgraded to c++17.