tensorcircuit
tensorcircuit copied to clipboard
Will be better if removing tensorflow prerequisite?
Since tensorcircuit does not rely on any specific backends, I wonder if it will be better to remove tensorflow from prerequisites, whose binaries are rather big (~500MB).
A very good question. Apart from the slow downloading due to the large size, TensorFlow as a requirement has other issues, too. Say in m1 mac, the package name is tensorflow-macos, which can lead to installation failure of tensorcircuit silently.
However, there are several reasons that support the inclusion of tensorflow as a requirement,
- some function utilities are now supported solely by tensorflow backend, such as
tc.quantum.heisenberg_hamiltonian. - if there is no requirement of tensorflow, then no backend with automatic differentiation is enabled by default which may confuse the users especially for newcomers. Namely, one need to manually install many things to make tensorcircuit work as expected. (this point is the main reason that I keep tensorflow as a requirement because I don't want to scare new users away by failure after
pip install tensorcircuit)
Still, to remove or not to remove tf as a requirement, is an question to me. Not sure which side is better, and would love to listen to more feedbacks.
2. if there is no requirement of tensorflow, then no backend with automatic differentiation is enabled by default which may confuse the users especially for newcomers. Namely, one need to manually install many things to make tensorcircuit work as expected. (this point is the main reason that I keep tensorflow as a requirement because I don't want to scare new users away by failure after
pip install tensorcircuit)
For the second point, how about changing the installation guide to the following lines?
pip install tensorflow
pip install tensorcircuit
I suppose it will not be less friendly for new users.
- some function utilities are now supported solely by tensorflow backend, such as
tc.quantum.heisenberg_hamiltonian.
And I am also curious about whether it would be convenient for us to re-implement those utilities by uniform API of tc.backend.
For now, my preference is to try something like below in furture releases
pip install tensorcircuit # only requires numpy
pip install tensorcircuit[tensorflow] # also install tensorflow
And I am also curious about whether it would be convenient for us to re-implement those utilities by uniform API of tc.backend.
It is more than welcome if anyone wants to make these utilities backend agnostic, which is a good first issue. These methods are in https://github.com/tencent-quantum-lab/tensorcircuit/blob/41f02549d9ee9d0c599488963394cd9e05b3e21f/tensorcircuit/quantum.py#L1108-L1388
closed, as the remaining issue is separately open in https://github.com/tencent-quantum-lab/tensorcircuit/issues/161