-1

cleverhans我使用以下内容安装Colab

!pip install -qq -e git+http://github.com/tensorflow/cleverhans.git#egg=cleverhans
import sys
sys.path.append('/content/src/cleverhans')
import cleverhans

它似乎运作良好。然后我使用以下内容:

from cleverhans.utils_keras import KerasModelWrapper
wrap = KerasModelWrapper(network)

我得到:

ModuleNotFoundError                       Traceback (most recent call last)

<ipython-input-42-bf6d85d04ab3> in <module>()
----> 1 from cleverhans.utils_keras import KerasModelWrapper
      2 wrap = KerasModelWrapper(network)

ModuleNotFoundError: No module named 'cleverhans.utils_keras'
4

1 回答 1

0

模块cleverhans.utils_kerascleverhans_v3.1.0的一部分。子目录有它自己的setup.py,即它自己独立的包。使用命令安装它

!pip install -U "git+https://github.com/cleverhans-lab/cleverhans.git#egg=cleverhans&subdirectory=cleverhans_v3.1.0"
于 2021-10-06T12:37:39.433 回答