Skip to content

Add support for TensorFlow 2.18#984

Open
psamanoelton wants to merge 1 commit intotensorflow:masterfrom
psamanoelton:feature/tf218_support
Open

Add support for TensorFlow 2.18#984
psamanoelton wants to merge 1 commit intotensorflow:masterfrom
psamanoelton:feature/tf218_support

Conversation

@psamanoelton
Copy link
Collaborator

Summary

  • Update TensorFlow Quantum build to support TensorFlow 2.18.1.
  • Align Eigen with TensorFlow 2.18.1’s pinned revision.
  • Define essential requirements in requirements.in and use pip-compile to produce requirements.txt

Key changes

  • WORKSPACE:
    • bump @org_tensorflow to 2.18.1
    • add lightweight alias repo (pypi_wheel & local_config_cuda) to satisfy TF’s @pypi_setuptools reference when rules_python generates @pypi__setuptools.
  • requirements.in:
    • set of requirements needed for building TFQ and running test scripts
    • requirements.txt is produced by running pip-compile --upgrade --generate-hashes -o requirements.txt requirements.in
  • tensorflow_quantum/python/differentiators/linear_combination.py:
    • Updated np.math to .math and importing math to properly handle numpy 2.0.2

Testing

  • Linux/Ubuntu 22.04 (Docker), Python 3.10, 3.11 & 3.12, Bazelisk → Bazel 6.5.0
  • bazel build ... release:build_pip_package succeeds
  • Unit tests (scripts/test_all.sh & ./scripts/ci_validate_tutorials.sh) pass
  • Wheel installs and imports with TF 2.18.1 + tf-keras 2.18, Cirq 1.5.0, NumPy 2.0.2

Notes

  • This keeps TFQ on Keras 2 path; Keras 3 migration can be handled in a a future PR.
  • This changes will help on the incoming upgrades to 2.20.

@psamanoelton psamanoelton requested a review from mhucka February 3, 2026 17:55
@mhucka mhucka self-assigned this Feb 4, 2026
Copy link
Member

@mhucka mhucka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really fantastic to see NumPy 2 and Cirq 1.5 compatibility. I just have one question, about the Eigen commit change. Otherwise LGTM.

Comment on lines 58 to +60
# This commit corresponds to Eigen version 3.4.90
# (verified via Eigen/src/Core/util/Macros.h).
EIGEN_COMMIT = "c1d637433e3b3f9012b226c2c9125c494b470ae6"
EIGEN_COMMIT = "33d0937c6bdf5ec999939fb17f2a553183d14a74"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit hash is changed, but the comment still refers to version 3.4.90. Does this commit still correspond to 3.4.90?

@mhucka mhucka mentioned this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants