advboxes / AdvBox

Advbox is a toolbox to generate adversarial examples that fool neural networks in PaddlePaddle、PyTorch、Caffe2、MxNet、Keras、TensorFlow and Advbox can benchmark the robustness of machine learning models. Advbox give a command line tool to generate adversarial examples with Zero-Coding.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tutorials/mnist_tutorial_fgsm.py 报错(paddle.fluid.core.OpDesc 没有 set_attr 方法)

Cody2333 opened this issue · comments

commented

版本

paddlepaddle v1.1.0

问题

运行 tutorials/mnist_tutorial_fgsm.py 报错:

Traceback (most recent call last):
  File "mnist_tutorial_fgsm.py", line 152, in <module>
    main()
  File "mnist_tutorial_fgsm.py", line 76, in main
    channel_axis=1)
  File "../advbox/models/paddle.py", line 79, in __init__
    op.setattr('is_test', True)
AttributeError: 'paddle.fluid.core.OpDesc' object has no attribute 'set_attr'

对应代码在这:
https://github.com/baidu/AdvBox/blob/fe7e5dc2bb7159c7296c7a3c410a7090d0260417/advbox/models/paddle.py#L79

看了一下应该是 paddlepaddle 把 set_attr 方法重命名成了 _set_attr,所以需要改一下对应代码?

对应的 PR 在这:
PaddlePaddle/Paddle#12543

谢谢 反馈 我想下咋兼容老版本

commented

#14 ,这样可以么

看样子也只能这样了 不过用老版本paddle的 就不能升级这个了 tks 我合并进去吧