企业级网站开发平台,网站为什么没有排名了,网上做问卷报酬不错的网站是,wordpress极慢项目场景#xff1a;
PyTorch 报错#xff1a;TypeError: exceptions must derive from BaseException
其实是个低级错误#xff0c;我个人认为是因为没有找到要运行的载体。 问题描述
在 base_options.py 里面设置 --netG 的参数只能在这几个里面选择#xff1a;
self…项目场景
PyTorch 报错TypeError: exceptions must derive from BaseException
其实是个低级错误我个人认为是因为没有找到要运行的载体。 问题描述
在 base_options.py 里面设置 --netG 的参数只能在这几个里面选择
self.parser.add_argument(--netG, typestr, defaultp2hed, choices[p2hed, refineD, p2hed_att], helpselects model to use for netG)
但是在选择 netG 时的代码写成了
def define_G(input_nc, output_nc, ngf, netG, n_downsample_global3, n_blocks_global9, n_local_enhancers1, n_blocks_local3, norminstance, gpu_ids[]): norm_layer get_norm_layer(norm_typenorm) if netG p2hed: netG DDNet_p2hED(input_nc, output_nc, ngf, n_downsample_global, n_blocks_global, norm_layer)elif netG refineDepth:netG DDNet_RefineDepth(input_nc, output_nc, ngf, n_downsample_global, n_blocks_global, n_local_enhancers, n_blocks_local, norm_layer)elif netG p2h_noatt: netG DDNet_p2hed_noatt(input_nc, output_nc, ngf, n_downsample_global, n_blocks_global, n_local_enhancers, n_blocks_local, norm_layer)else:raise(generator not implemented!)#print(netG)if len(gpu_ids) 0:assert(torch.cuda.is_available()) netG.cuda(gpu_ids[0])netG.apply(weights_init)return netG 原因分析 注意没有 ‘rfineD’ 这个选项所以当运行代码时程序找不到 netG 该选择那个网络故而报错。 解决方案 其实把上面那个代码里面的 “ elif netG refineDepth: ” 改成 “elif netG refineD:” 就可以了。