动态图,多个输出调用optimizer.minimize()失败
Created by: ryancuicui
1)PaddlePaddle版本:1.5.1 2)CPU版本 3)系统环境:centos 7.1,Python 2.7.6
- 训练信息 1)单机
- 问题描述:请详细描述您的问题,同步贴出报错信息、日志、可复现的代码片段 当使用动态图时,如果网络有多个输出 在主程序调用网络 如果执行下面程序,程序就会报错 x_pose = fluid.layers.mean(x_pose) x_pose.backward() adam.minimize(x_pose) 报错信息如下: Traceback (most recent call last): File "main_1.py", line 141, in adam.minimize(loss_vertex_pose) File "", line 2, in minimize File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl return wrapped_func(*args, **kwargs) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/dygraph/base.py", line 87, in impl return func(*args, kwargs) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 601, in minimize loss, startup_program=startup_program, params_grads=params_grads) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 558, in apply_optimize optimize_ops = self._create_optimization_pass(params_grads) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 376, in _create_optimization_pass param_and_grad) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/optimizer.py", line 1383, in _append_optimize_op stop_gradient=True) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1762, in append_op kwargs.get("stop_gradient", False)) File "/home/xushengzeng/anaconda2/lib/python2.7/site-packages/paddle/fluid/dygraph/tracer.py", line 59, in trace_op framework.current_expected_place(), stop_gradient) paddle.fluid.core_avx.EnforceNotMet: holder should not be null Tensor not initialized yet when Tensor::place() is called. at [/paddle/paddle/fluid/framework/tensor.h:133] PaddlePaddle Call Stacks: 0 0x7fe0e3067bf8p void paddle::platform::EnforceNotMet::Initstd::string(std::string, char const, int) + 360 1 0x7fe0e3067f47p paddle::platform::EnforceNotMet::EnforceNotMet(std::string const&, char const, int) + 87 2 0x7fe0e324aad9p paddle::imperative::GetExpectedPlace(boost::variant<paddle::platform::CUDAPlace, paddle::platform::CPUPlace, paddle::platform::CUDAPinnedPlace, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_, boost::detail::variant::void_>, std::map<std::string, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > >, std::lessstd::string, std::allocator<std::pair<std::string const, std::vector<std::shared_ptrpaddle::imperative::VarBase, std::allocator<std::shared_ptrpaddle::imperative::VarBase > > > > >) + 617 3 0x7fe0e324cd45p 4 0x7fe0e314b930p 5 0x7fe0e3096ceep 6 0x7fe113948577p PyEval_EvalFrameEx + 28695 7 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 8 0x7fe113947f68p PyEval_EvalFrameEx + 27144 9 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 10 0x7fe113947f68p PyEval_EvalFrameEx + 27144 11 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 12 0x7fe113947f68p PyEval_EvalFrameEx + 27144 13 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 14 0x7fe113947f68p PyEval_EvalFrameEx + 27144 15 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 16 0x7fe113947f68p PyEval_EvalFrameEx + 27144 17 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 18 0x7fe1138d37c7p 19 0x7fe1138aeb73p PyObject_Call + 67 20 0x7fe113943a6ep PyEval_EvalFrameEx + 9486 21 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 22 0x7fe1138d37c7p 23 0x7fe1138aeb73p PyObject_Call + 67 24 0x7fe113943a6ep PyEval_EvalFrameEx + 9486 25 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 26 0x7fe113947f68p PyEval_EvalFrameEx + 27144 27 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 28 0x7fe113947f68p PyEval_EvalFrameEx + 27144 29 0x7fe11394aa99p PyEval_EvalCodeEx + 2025 30 0x7fe11394acbap PyEval_EvalCode + 26 31 0x7fe11396401dp 32 0x7fe1139651c8p PyRun_FileExFlags + 120 33 0x7fe1139663e8p PyRun_SimpleFileExFlags + 232 34 0x7fe11397867cp Py_Main + 2988 35 0x7fe112b5fb15p __libc_start_main + 245 36 0x7fe113a4907fp 而如果网络只返回一个输出,如下图,则不会出现上述问题。 请问paddlepaddle动态图的梯度回传是不是还没支持多个输出的反传?