解决AttributeError: ‘Namespace‘ object has no attribute ‘arch‘

问题描述

在运行ACmix-ResNet模型时出现问题

Traceback (most recent call last):
  File "E:/Code/PyCharm/Paddle/main.py", line 504, in <module>
    main()
  File "E:/Code/PyCharm/Paddle/main.py", line 116, in main
    main_worker(args.gpu, ngpus_per_node, args)
  File "E:/Code/PyCharm/Paddle/main.py", line 260, in main_worker
    'arch': args.arch,
AttributeError: 'Namespace' object has no attribute 'arch'

原因分析:

很简单的一个错误,没有添加参数

解决方案:

使用parser添加相应参数即可

parser.add_argument('--arch', default=1, type=float, metavar='M',
                    help='arch')

你可能感兴趣的:(PyTorch,python,开发语言,pytorch,深度学习,神经网络)