2020/4/13日博客来了:
今天在跑advGAN代码的时候遇到了错误,提示如下:
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
博主鲜用pytorch上网一搜发现这个错误大概是多线程的错误,python的多线程是一个不太优秀的东西,我就直接说解决方法吧,在自己的代码的主函数里加上
if __name__ == '__main__':
就可以运行啦。