cannot import name 'spectral_norm' from 'paddle.nn.utils'
本以为会很顺利,却还是报错了,报错内容如下:
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/layers/utils.py:26: DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance:
def convert_to_list(value, n, name, dtype=np.int):
Traceback (most recent call last):
File "tools/first-order-demo.py", line 18, in
from ppgan.apps.first_order_predictor import FirstOrderPredictor
File "/home/aistudio/PaddleGAN/ppgan/apps/__init__.py", line 16, in
from .deepremaster_predictor import DeepRemasterPredictor
File "/home/aistudio/PaddleGAN/ppgan/apps/deepremaster_predictor.py", line 24, in
from ppgan.models.generators.remaster import NetworkR, NetworkC
File "/home/aistudio/PaddleGAN/ppgan/models/__init__.py", line 15, in
from .base_model import BaseModel
File "/home/aistudio/PaddleGAN/ppgan/models/base_model.py", line 22, in
from .criterions.builder import build_criterion
File "/home/aistudio/PaddleGAN/ppgan/models/criterions/__init__.py", line 3, in
from .pixel_loss import L1Loss, MSELoss, CharbonnierLoss, \
File "/home/aistudio/PaddleGAN/ppgan/models/criterions/pixel_loss.py", line 16, in
from ..generators.generater_lapstyle import calc_mean_std, mean_variance_norm
File "/home/aistudio/PaddleGAN/ppgan/models/generators/__init__.py", line 36, in
from .gpen import GPEN
File "/home/aistudio/PaddleGAN/ppgan/models/generators/gpen.py", line 21, in
from ppgan.models.discriminators.discriminator_styleganv2 import ConvLayer
File "/home/aistudio/PaddleGAN/ppgan/models/discriminators/__init__.py", line 26, in
from .discriminator_photopen import MultiscaleDiscriminator
File "/home/aistudio/PaddleGAN/ppgan/models/discriminators/discriminator_photopen.py", line 22, in
from paddle.nn.utils import spectral_norm
ImportError: cannot import name 'spectral_norm' from 'paddle.nn.utils' (/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/nn/utils/__init__.py)