当我运行p.start()时,我得到了TypeError:' generator'对象不可调用

时间:2017-06-27 00:33:13

标签: python pytorch

if __name__ == '__main__':
        # num_processes = 4
        # NOTE: this is required for the ``fork`` method to work
        torch.manual_seed(args.seed)
        cnn.share_memory()
        processes = []
        for rank in range(args.num_processes):
            p = mu.Process(target=train.train, args=(rank, train_iter, dev_iter, cnn, args,))
            p.start()
            processes.append(p)
        for p in processes:
            p.join()

当我运行p.start()时,此处出现错误,以下是错误消息,任何人都可以帮助我,谢谢:

Traceback (most recent call last):
  File "E:/workspace/pycharmworkspace/cnn-text-classification-pytorch-update/main.py", line 144, in <module>
    p.start()
  File "C:\Users\bamtercelboo\Anaconda3\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\Users\bamtercelboo\Anaconda3\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Users\bamtercelboo\Anaconda3\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\bamtercelboo\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
    reduction.dump(process_obj, to_child)
  File "C:\Users\bamtercelboo\Anaconda3\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: 'generator' object is not callable

0 个答案:

没有答案