Skip to content

Commit a4eefc5

Browse files
feat: Remove support for TensorFlow (#2609)
* Remove support for TensorFlow from the codebase. - This is a breaking change. - Remove the TensorFlow backend and optimize/opt_tflow.py. * Remove use of TensorFlow from the tests. - Remove TensorFlow lower bounds from tests/constraints.txt. * Remove all docs and examples that mention or use TensorFlow. * Remove mentions of TensorFlow in all parts of the website and REAMDE except for historical purposes like the release notes, JOSS paper, and notes about early pyhf research in FAQs. Co-authored-by: Giordon Stark <[email protected]>
1 parent 135d029 commit a4eefc5

31 files changed

+38
-1414
lines changed

.zenodo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"fitting",
2929
"scipy",
3030
"numpy",
31-
"tensorflow",
3231
"pytorch",
3332
"jax",
3433
"auto-differentiation"

CITATION.cff

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ keywords:
2626
- fitting
2727
- scipy
2828
- numpy
29-
- tensorflow
3029
- pytorch
3130
- jax
3231
- auto-differentiation
@@ -38,7 +37,7 @@ abstract: |
3837
of that statistical model for multi-bin histogram-based analysis and its
3938
interval estimation is based on the asymptotic formulas of "Asymptotic
4039
formulae for likelihood-based tests of new physics". pyhf supports modern
41-
computational graph libraries such as TensorFlow, PyTorch, and JAX in order
40+
computational graph libraries such as PyTorch and JAX in order
4241
to make use of features such as autodifferentiation and GPU acceleration.
4342
references:
4443
- type: article

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on the asymptotic formulas of “Asymptotic formulae for likelihood-based
2929
tests of new physics”
3030
[`arXiv:1007.1727 <https://arxiv.org/abs/1007.1727>`__]. The aim is also
3131
to support modern computational graph libraries such as PyTorch and
32-
TensorFlow in order to make use of features such as autodifferentiation
32+
JAX in order to make use of features such as autodifferentiation
3333
and GPU acceleration.
3434

3535
..
@@ -145,7 +145,6 @@ Implemented variations:
145145
Computational Backends:
146146
- ☑ NumPy
147147
- ☑ PyTorch
148-
- ☑ TensorFlow
149148
- ☑ JAX
150149
151150
Optimizers:

docker/gpu/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN apt-get update -y && \
1313
COPY . /code
1414
COPY ./docker/gpu/install_backend.sh /code/install_backend.sh
1515
WORKDIR /code
16-
ARG BACKEND=tensorflow
16+
ARG BACKEND=jax
1717
RUN python3 -m pip --no-cache-dir install --upgrade pip wheel && \
1818
/bin/bash install_backend.sh ${BACKEND} && \
1919
python3 -m pip list

docker/gpu/install_backend.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ function get_JAXLIB_GPU_WHEEL {
1818
function install_backend() {
1919
# 1: the backend option name in setup.py
2020
local backend="${1}"
21-
if [[ "${backend}" == "tensorflow" ]]; then
22-
# shellcheck disable=SC2102
23-
python3 -m pip install --no-cache-dir .[xmlio,tensorflow]
24-
elif [[ "${backend}" == "torch" ]]; then
21+
if [[ "${backend}" == "torch" ]]; then
2522
# shellcheck disable=SC2102
2623
python3 -m pip install --no-cache-dir .[xmlio,torch]
2724
elif [[ "${backend}" == "jax" ]]; then

docs/api.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ The computational backends that :code:`pyhf` provides interfacing for the vector
6666

6767
numpy_backend.numpy_backend
6868
pytorch_backend.pytorch_backend
69-
tensorflow_backend.tensorflow_backend
7069
jax_backend.jax_backend
7170

7271
Optimizers

docs/conf.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,9 @@ def setup(app):
146146
# today_fmt = '%B %d, %Y'
147147

148148
autodoc_mock_imports = [
149-
'tensorflow',
150149
'torch',
151150
'jax',
152151
'iminuit',
153-
'tensorflow_probability',
154152
]
155153

156154

@@ -195,7 +193,6 @@ def setup(app):
195193
'examples/notebooks/ImpactPlot.ipynb',
196194
'examples/notebooks/Recast.ipynb',
197195
'examples/notebooks/StatError.ipynb',
198-
'examples/notebooks/example-tensorflow.ipynb',
199196
'examples/notebooks/histogrammar.ipynb',
200197
'examples/notebooks/histosys.ipynb',
201198
'examples/notebooks/histosys-pytorch.ipynb',
@@ -205,7 +202,6 @@ def setup(app):
205202
'examples/notebooks/normsys.ipynb',
206203
'examples/notebooks/pullplot.ipynb',
207204
'examples/notebooks/pytorch_tests_onoff.ipynb',
208-
'examples/notebooks/tensorflow-limit.ipynb',
209205
]
210206

211207
# The reST default role (used for this markup: `text`) to use for all

docs/examples/experiments/edwardpyhf.ipynb

Lines changed: 0 additions & 126 deletions
This file was deleted.

docs/examples/notebooks/example-tensorflow.ipynb

Lines changed: 0 additions & 179 deletions
This file was deleted.

docs/examples/notebooks/histosys-pytorch.ipynb

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@
2626
},
2727
{
2828
"cell_type": "code",
29-
"execution_count": 2,
29+
"execution_count": null,
3030
"metadata": {},
3131
"outputs": [],
3232
"source": [
3333
"import pyhf\n",
3434
"from pyhf import Model\n",
35-
"from pyhf.simplemodels import uncorrelated_background\n",
36-
"\n",
37-
"import tensorflow as tf"
35+
"from pyhf.simplemodels import uncorrelated_background"
3836
]
3937
},
4038
{
@@ -78,7 +76,7 @@
7876
},
7977
{
8078
"cell_type": "code",
81-
"execution_count": 4,
79+
"execution_count": null,
8280
"metadata": {},
8381
"outputs": [
8482
{
@@ -89,9 +87,6 @@
8987
"# NumPy\n",
9088
"<class 'numpy.ndarray'> [-23.57960517]\n",
9189
"\n",
92-
"# TensorFlow\n",
93-
"<class 'tensorflow.python.framework.ops.Tensor'> Tensor(\"Reshape_1:0\", shape=(1,), dtype=float32)\n",
94-
"\n",
9590
"# PyTorch\n",
9691
"<class 'torch.Tensor'> tensor([-23.5796])\n"
9792
]
@@ -100,12 +95,10 @@
10095
"source": [
10196
"backends = [\n",
10297
" pyhf.tensor.numpy_backend(),\n",
103-
" pyhf.tensor.tensorflow_backend(session=tf.Session()),\n",
10498
" pyhf.tensor.pytorch_backend(),\n",
10599
"]\n",
106100
"names = [\n",
107101
" 'NumPy',\n",
108-
" 'TensorFlow',\n",
109102
" 'PyTorch',\n",
110103
"]\n",
111104
"\n",

0 commit comments

Comments
 (0)