batch_norm 未初始化错误
Created by: JingChunzhen
paddle 1.5.0 cpu版本
def test_std_bn():
import paddle.fluid as fluid
import numpy as np
x = fluid.layers.data(name='x', shape=[-1, 3], dtype='float32')
y = fluid.layers.data(name='y', shape=[-1, 3], dtype='float32')
hidden1 = fluid.layers.fc(input=x, size=200) # (-1, 200)
hidden2 = fluid.layers.batch_norm(input=hidden1) # (-1, 200)
yhidden1 = fluid.layers.fc(input=y, size=200)
yhidden2 = fluid.layers.batch_norm(input=yhidden1)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(7, 3)).astype('float32')
h1, output = exe.run(feed={"x": np_x}, fetch_list = [hidden1, hidden2])
yh1, youtput = exe.run(feed={"y": np_x}, fetch_list = [yhidden1, yhidden2])
出现错误
/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/sklearn/externals/joblib/_multiprocessing_helpers.py:38: UserWarning: [Errno 13] Permission denied. joblib will operate in serial mode
warnings.warn('%s. joblib will operate in serial mode' % (e,))
Traceback (most recent call last):
File "test_paddle.py", line 370, in <module>
test_std_bn()
File "test_paddle.py", line 357, in test_std_bn
h1, output = exe.run(feed={"x": np_x}, fetch_list = [hidden1, hidden2])
File "/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/executor.py", line 657, in run
use_program_cache=use_program_cache)
File "/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/executor.py", line 755, in _run
exe.run(program.desc, scope, 0, True, True, fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet: Invoke operator mul error.
Python Call stacks:
File "/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1774, in append_op
attrs=kwargs.get("attrs", None))
File "/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/layer_helper.py", line 43, in append_op
return self.main_program.current_block().append_op(*args, **kwargs)
File "/home/jingchunzhen/paddle_release_home/python/lib/python2.7/site-packages/paddle/fluid/layers/nn.py", line 334, in fc
"y_num_col_dims": 1})
File "test_paddle.py", line 349, in test_std_bn
yhidden1 = fluid.layers.fc(input=y, size=200)
File "test_paddle.py", line 370, in <module>
test_std_bn()
C++ Call stacks:
Input X(0) is not initialized at [/paddle/paddle/fluid/framework/operator.cc:1128]
PaddlePaddle Call Stacks:
0 0x7f8058a6b360p void paddle::platform::EnforceNotMet::Init<char const*>(char const*, char const*, int) + 352
1 0x7f8058a6b6d9p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 137
2 0x7f8059dc892fp paddle::framework::OperatorWithKernel::IndicateDataType(paddle::framework::ExecutionContext const&) const + 1343
3 0x7f8059dc8b1fp paddle::framework::OperatorWithKernel::GetExpectedKernelType(paddle::framework::ExecutionContext const&) const + 47
4 0x7f8059dc9d5bp paddle::framework::OperatorWithKernel::ChooseKernel(paddle::framework::RuntimeContext const&, paddle::framework::Scope const&, 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_> const&) const + 235
5 0x7f8059dcb218p paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, 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_> const&, paddle::framework::RuntimeContext*) const + 728
6 0x7f8059dcb821p paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, 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_> const&) const + 529
7 0x7f8059dc67c4p paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, 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_> const&) + 260
8 0x7f8058bed98ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 206
9 0x7f8058bf0a1fp paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool, std::vector<std::string, std::allocator<std::string> > const&, bool) + 143
10 0x7f8058a5db2dp
11 0x7f8058a9af9ep
12 0x7f809b7c8bb8p PyEval_EvalFrameEx + 25016
13 0x7f809b7cc0bdp PyEval_EvalCodeEx + 2061
14 0x7f809b7c9345p PyEval_EvalFrameEx + 26949
15 0x7f809b7cc0bdp PyEval_EvalCodeEx + 2061
16 0x7f809b7c9345p PyEval_EvalFrameEx + 26949
17 0x7f809b7c9460p PyEval_EvalFrameEx + 27232
18 0x7f809b7cc0bdp PyEval_EvalCodeEx + 2061
19 0x7f809b7cc1f2p PyEval_EvalCode + 50
20 0x7f809b7f4f42p PyRun_FileExFlags + 146
21 0x7f809b7f62d9p PyRun_SimpleFileExFlags + 217
22 0x7f809b80c00dp Py_Main + 3149
23 0x7f809aa09bd5p __libc_start_main + 245
24 0x4007a1p