【发布时间】:2018-02-02 03:41:20
【问题描述】:
我正在查看this script,这里有一个代码块考虑了两个选项,DataParallel 和DistributedDataParallel:
if not args.distributed:
if args.arch.startswith('alexnet') or args.arch.startswith('vgg'):
model.features = torch.nn.DataParallel(model.features)
model.cuda()
else:
model = torch.nn.DataParallel(model).cuda()
else:
model.cuda()
model = torch.nn.parallel.DistributedDataParallel(model)
如果我不想要这些选项中的任何一个,并且我想在没有DataParallel 的情况下运行它。我该怎么做?
如何定义我的模型,以便它以普通的nn 运行而不并行化任何东西?
【问题讨论】:
标签: python machine-learning pytorch