我正在尝试对 mnist 数据集运行 fgsm 攻击。我收到“对象没有属性”错误:
我使用过:python 2(在 google colab 中)Keras==2.1.3 tensorflow==1.14.0
我还使用 keras==1.2 和 keras==2.1.5 运行它,我还将 get_config 转换为 _get_config,但是,所有运行都失败了。
Unit_keras.py 在这里:https
://github.com/tensorflow/cleverhans/blob/master/cleverhans/utils_keras.py
我也使用过:https ://github.com/tensorflow/cleverhans/blob/6b065c4507f50e2545c009f75e82678f92353163/cleverhans/utils_keras .py
x_adv_sub = fgsm.generate(images_tensor, **fgsm_par)
File "/content/defensegan/cleverhans/attacks/fast_gradient_method.py",
line 50, in generate
labels, _nb_classes = self.get_or_guess_labels(x, kwargs)
File "/content/defensegan/cleverhans/attacks/attack.py", line 278, in
get_or_guess_labels
preds = self.model.get_probs(x)
File "/content/defensegan/cleverhans/utils_keras.py", line 196, in
get_probs
:return: Names of all the layers kept by Keras
File "/content/defensegan/cleverhans/utils_keras.py", line 130, in
_get_softmax_name
def _get_abstract_layer_name(self):
AttributeError: 'Conv2D' object has no attribute 'get_config'