我正在尝试对mnist数据集进行fgsm攻击。我收到“对象没有属性”错误:
我用了:
python 2(在Google colab中)
凯拉斯== 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'