From 196cef332de90fc8e0a41145e2d0539c9f425ac3 Mon Sep 17 00:00:00 2001
From: Paul Andrey <paul.andrey@inria.fr>
Date: Thu, 29 Feb 2024 17:30:18 +0100
Subject: [PATCH] Update TensorFlow (optional) dependency version
 specification.

Set minimal version to 2.11.0 (rather than 2.5.0):
- 'TensorflowOptiModule' adapter is based on the "new" Optimizer API
  introduced with TensorFlow/Keras v2.11, but the required dependency
  version had not been updated until now.

Set maximal version to 2.15.X:
- TensorFlow 2.16 (the first release candidate of which was added to
  PyPI three days ago) is switching to Keras 3 by default, which is
  bound to introduce breaking changes (current unit tests fail with
  'tensorflow==2.16.0rc0').
- For now, the maximal version is thus set to 2.15.X. This may change
  in the near future when some time and effort is put in understanding
  changes and/or configuring dependencies to keep using Keras 2 rather
  than Keras 3 in TensorFlow's backend.
---
 pyproject.toml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 49d828a5..2223f3d6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -53,7 +53,7 @@ all = [  # all non-tests extra dependencies
     "jax[cpu] ~= 0.4.1",
     "opacus ~= 1.4",
     "protobuf >= 3.19",
-    "tensorflow ~= 2.5",
+    "tensorflow ~= 2.11, < 2.16",
     "torch >= 1.13, < 3.0",
     "websockets >= 10.1, < 13.0",
 ]
@@ -71,7 +71,7 @@ haiku = [
     "jax[cpu] ~= 0.4.1",  # NOTE: GPU support must be manually installed
 ]
 tensorflow = [
-    "tensorflow ~= 2.5",
+    "tensorflow ~= 2.11, < 2.16",  # starting with 2.16 TF upgrades to Keras 3
 ]
 torch = [  # generic requirements for Torch
     "torch >= 1.13, < 3.0",
-- 
GitLab