請教一個pytorch的問題

請教大家,我在用pytorch進行訓練時,出現如下問題,哪位高手幫忙看看怎麼解決呢,非常感謝

/home/wkp/anaconda3/bin/python /home/wkp/PycharmProjects/20200218DehazeNet/main_yy4.py
Epoch= 0 |Step= 0 |Loss=226.8521 pred=0.0000 Training duation: 0.4874
Traceback (most recent call last):
  File "/home/wkp/PycharmProjects/20200218DehazeNet/main_yy4.py", line 99, in <module>
    output_x = myNet(x_test, y_test)
  File "/home/wkp/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/wkp/anaconda3/lib/python3.7/site-packages/torch/nn/parallel/distributed.py", line 390, in forward
    self.reducer.prepare_for_backward(list(_find_tensors(output)))
RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing its output (the return value of `forward`). You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`. If you already have this argument set, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable). (prepare_for_backward at /pytorch/torch/csrc/distributed/c10d/reducer.cpp:408)
frame #0: std::function<std::string ()>::operator()() const + 0x11 (0x7fd03dbe9441 in /home/wkp/anaconda3/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x2a (0x7fd03dbe8d7a in /home/wkp/anaconda3/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #2: c10d::Reducer::prepare_for_backward(std::vector<torch::autograd::Variable, std::allocator<torch::autograd::Variable> > const&) + 0x5ec (0x7fd07d489abc in /home/wkp/anaconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #3: <unknown function> + 0x6c753d (0x7fd07d47f53d in /home/wkp/anaconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #4: <unknown function> + 0x130fac (0x7fd07cee8fac in /home/wkp/anaconda3/lib/python3.7/site-packages/torch/lib/libtorch_python.so)
frame #5: _PyMethodDef_RawFastCallKeywords + 0x254 (0x55f431ead744 in /home/wkp/anaconda3/bin/python)
frame #6: _PyCFunction_FastCallKeywords + 0x21 (0x55f431ead861 in /home/wkp/anaconda3/bin/python)
frame #7: _PyEval_EvalFrameDefault + 0x52f8 (0x55f431f196e8 in /home/wkp/anaconda3/bin/python)
frame #8: _PyEval_EvalCodeWithName + 0x2f9 (0x55f431e5d539 in /home/wkp/anaconda3/bin/python)
frame #9: _PyFunction_FastCallDict + 0x1d5 (0x55f431e5e635 in /home/wkp/anaconda3/bin/python)
frame #10: _PyObject_Call_Prepend + 0x63 (0x55f431e7ce53 in /home/wkp/anaconda3/bin/python)
frame #11: PyObject_Call + 0x6e (0x55f431e6fdbe in /home/wkp/anaconda3/bin/python)
frame #12: _PyEval_EvalFrameDefault + 0x1e42 (0x55f431f16232 in /home/wkp/anaconda3/bin/python)
frame #13: _PyEval_EvalCodeWithName + 0x2f9 (0x55f431e5d539 in /home/wkp/anaconda3/bin/python)
frame #14: _PyFunction_FastCallDict + 0x1d5 (0x55f431e5e635 in /home/wkp/anaconda3/bin/python)
frame #15: _PyObject_Call_Prepend + 0x63 (0x55f431e7ce53 in /home/wkp/anaconda3/bin/python)
frame #16: <unknown function> + 0x16ba3a (0x55f431eb4a3a in /home/wkp/anaconda3/bin/python)
frame #17: _PyObject_FastCallKeywords + 0x49b (0x55f431eb58fb in /home/wkp/anaconda3/bin/python)
frame #18: _PyEval_EvalFrameDefault + 0x4a96 (0x55f431f18e86 in /home/wkp/anaconda3/bin/python)
frame #19: _PyEval_EvalCodeWithName + 0x2f9 (0x55f431e5d539 in /home/wkp/anaconda3/bin/python)
frame #20: PyEval_EvalCodeEx + 0x44 (0x55f431e5e424 in /home/wkp/anaconda3/bin/python)
frame #21: PyEval_EvalCode + 0x1c (0x55f431e5e44c in /home/wkp/anaconda3/bin/python)
frame #22: <unknown function> + 0x22ab74 (0x55f431f73b74 in /home/wkp/anaconda3/bin/python)
frame #23: PyRun_FileExFlags + 0xa1 (0x55f431f7deb1 in /home/wkp/anaconda3/bin/python)
frame #24: PyRun_SimpleFileExFlags + 0x1c3 (0x55f431f7e0a3 in /home/wkp/anaconda3/bin/python)
frame #25: <unknown function> + 0x236195 (0x55f431f7f195 in /home/wkp/anaconda3/bin/python)
frame #26: _Py_UnixMain + 0x3c (0x55f431f7f2bc in /home/wkp/anaconda3/bin/python)
frame #27: __libc_start_main + 0xe7 (0x7fd08cc07b97 in /lib/x86_64-linux-gnu/libc.so.6)
frame #28: <unknown function> + 0x1db062 (0x55f431f24062 in /home/wkp/anaconda3/bin/python)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章