Skip to content

Commit 2d37a8c

Browse files
committed
Remove support for MXNet and TensorFlow v1
Signed-off-by: Beat Buesser <[email protected]>
1 parent af8ea12 commit 2d37a8c

File tree

81 files changed

+223
-1860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+223
-1860
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ If applicable, add screenshots to help explain your problem.
2424
- OS
2525
- Python version
2626
- ART version or commit number
27-
- TensorFlow / Keras / PyTorch / MXNet version
27+
- TensorFlow / Keras / PyTorch version

.github/workflows/ci-mxnet.yml

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

.github/workflows/ci-tensorflow-v1.yml

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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN apt-get install -y python3 python3-distutils python3-pip
77
RUN pip3 install tensorflow==2.9.1 keras==2.9.0 numpy==1.22.4 scipy==1.8.1 matplotlib==3.5.2 scikit-learn==1.1.2 \
88
six==1.15.0 Pillow==9.2.0 pytest-cov==3.0.0 tqdm==4.64.0 statsmodels==0.13.2 pydub==0.25.1 \
99
resampy==0.3.1 ffmpeg-python==0.2.0 cma==3.2.2 pandas==1.4.3 h5py==3.7.0 tensorflow-addons==0.17.1 \
10-
mxnet==1.6.0 torch==1.12.0 torchaudio==0.12.0 torchvision==0.13.0 catboost==1.0.6 GPy==1.10.0 \
10+
torch==1.12.0 torchaudio==0.12.0 torchvision==0.13.0 catboost==1.0.6 GPy==1.10.0 \
1111
lightgbm==3.3.2 xgboost==1.6.1 kornia==0.6.6 lief==0.12.1 pytest==7.1.2 pytest-pep8==1.0.6 \
1212
pytest-mock==3.8.2 requests==2.28.1
1313

PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Please describe the tests that you ran to verify your changes. Consider listing
2525
- OS
2626
- Python version
2727
- ART version or commit number
28-
- TensorFlow / Keras / PyTorch / MXNet version
28+
- TensorFlow / Keras / PyTorch version
2929

3030
# Checklist
3131

README-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
[Linux Foundation AI & Data Foundation](https://lfaidata.foundation) (LF AI & Data)。 ART提供的工具可
2525
帮助开发人员和研究人员针对以下方面捍卫和评估机器学习模型和应用程序:
2626
逃逸,数据污染,模型提取和推断的对抗性威胁。ART支持所有流行的机器学习框架
27-
(TensorFlow,Keras,PyTorch,MXNet,scikit-learn,XGBoost,LightGBM,CatBoost,GPy等),所有数据类型
27+
(TensorFlow,Keras,PyTorch,scikit-learn,XGBoost,LightGBM,CatBoost,GPy等),所有数据类型
2828
(图像,表格,音频,视频等)和机器学习任务(分类,物体检测,语音识别,
2929
生成模型,认证等)。
3030

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Adversarial Robustness Toolbox (ART) is a Python library for Machine Learning Se
2626
[Linux Foundation AI & Data Foundation](https://lfaidata.foundation) (LF AI & Data). ART provides tools that enable
2727
developers and researchers to defend and evaluate Machine Learning models and applications against the
2828
adversarial threats of Evasion, Poisoning, Extraction, and Inference. ART supports all popular machine learning frameworks
29-
(TensorFlow, Keras, PyTorch, MXNet, scikit-learn, XGBoost, LightGBM, CatBoost, GPy, etc.), all data types
29+
(TensorFlow, Keras, PyTorch, scikit-learn, XGBoost, LightGBM, CatBoost, GPy, etc.), all data types
3030
(images, tables, audio, video, etc.) and machine learning tasks (classification, object detection, speech recognition,
3131
generation, certification, etc.).
3232

art/attacks/evasion/auto_projected_gradient_descent.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,7 @@ def __init__(
9292
"cross_entropy", or "difference_logits_ratio"
9393
:param verbose: Show progress bars.
9494
"""
95-
from art.estimators.classification import TensorFlowClassifier, TensorFlowV2Classifier, PyTorchClassifier
96-
97-
if isinstance(estimator, TensorFlowClassifier):
98-
raise ValueError("This attack does not support TensorFlow v1.")
95+
from art.estimators.classification import TensorFlowV2Classifier, PyTorchClassifier
9996

10097
if loss_type not in self._predefined_losses:
10198
raise ValueError(

art/attacks/poisoning/feature_collision_attack.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,7 @@ def tensor_norm(tensor, norm_type: int | float | str = 2): # pylint: disable=in
301301
"tensorflow.python.framework.ops.SymbolicTensor",
302302
)
303303
torch_tensor_types = ("torch.Tensor", "torch.float", "torch.double", "torch.long")
304-
mxnet_tensor_types = ()
305-
supported_types = tf_tensor_types + torch_tensor_types + mxnet_tensor_types
304+
supported_types = tf_tensor_types + torch_tensor_types
306305
tensor_type = get_class_name(tensor)
307306
if tensor_type not in supported_types: # pragma: no cover
308307
raise TypeError("Tensor type `" + tensor_type + "` is not supported")
@@ -316,8 +315,3 @@ def tensor_norm(tensor, norm_type: int | float | str = 2): # pylint: disable=in
316315
import torch
317316

318317
return torch.norm
319-
320-
if tensor_type in mxnet_tensor_types: # pragma: no cover
321-
import mxnet
322-
323-
return mxnet.ndarray.norm(tensor, ord=norm_type)

art/data_generators.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333

3434
if TYPE_CHECKING:
3535
import keras
36-
import mxnet
3736
import tensorflow as tf
3837
import torch
3938

@@ -258,47 +257,6 @@ def get_batch(self) -> tuple:
258257
return tuple(batch)
259258

260259

261-
class MXDataGenerator(DataGenerator):
262-
"""
263-
Wrapper class on top of the MXNet/Gluon native data loader :class:`mxnet.gluon.data.DataLoader`.
264-
"""
265-
266-
def __init__(self, iterator: "mxnet.gluon.data.DataLoader", size: int, batch_size: int) -> None:
267-
"""
268-
Create a data generator wrapper on top of an MXNet :class:`DataLoader`.
269-
270-
:param iterator: A MXNet DataLoader instance.
271-
:param size: Total size of the dataset.
272-
:param batch_size: Size of the minibatches.
273-
"""
274-
import mxnet
275-
276-
super().__init__(size=size, batch_size=batch_size)
277-
if not isinstance(iterator, mxnet.gluon.data.DataLoader):
278-
raise TypeError(f"Expected instance of Gluon `DataLoader, received {type(iterator)} instead.`")
279-
280-
self._iterator = iterator
281-
self._current = iter(self.iterator)
282-
283-
def get_batch(self) -> tuple:
284-
"""
285-
Provide the next batch for training in the form of a tuple `(x, y)`. The generator should loop over the data
286-
indefinitely.
287-
288-
:return: A tuple containing a batch of data `(x, y)`.
289-
"""
290-
try:
291-
batch = list(next(self._current))
292-
except StopIteration:
293-
self._current = iter(self.iterator)
294-
batch = list(next(self._current))
295-
296-
for i, item in enumerate(batch):
297-
batch[i] = item.asnumpy()
298-
299-
return tuple(batch)
300-
301-
302260
class TensorFlowDataGenerator(DataGenerator): # pragma: no cover
303261
"""
304262
Wrapper class on top of the TensorFlow native iterators :class:`tf.data.Iterator`.

0 commit comments

Comments
 (0)