paddle.fluid.core.EnforceNotMet: Invoke operator clip error.
Created by: bluemandora
1)PaddlePaddle版本:1.4.1 4)系统环境:centos6.3,Python2.7
-
训练信息 1)单机单卡
-
需求就是在embedding之前对输入做一下clip,防止数组越界,使用以下代码不会报错
feature = fluid.layers.data(name=attr_name, shape=[1], dtype='int64')
emb_feature = fluid.layers.embedding(input=feature,size=[conf['dimensions'], conf['emb_size']],
param_attr=fluid.ParamAttr(name=group_name,initializer=fluid.initializer.Normal(scale=0.3)))
- 如果增加一层clip,则会报错:
raw_feature = fluid.layers.data(name=attr_name, shape=[1], dtype='int64')
feature = fluid.layers.clip(x=raw_feature, min=0.0, max=10.0)
emb_feature = fluid.layers.embedding(input=feature,size=[10, 8],
param_attr=fluid.ParamAttr(name=group_name,initializer=fluid.initializer.Normal(scale=0.3)))
报错信息:
Traceback (most recent call last):
File "train.py", line 289, in <module>
train()
File "train.py", line 249, in train
predictor, cost, test_program, label_offset)
File "train.py", line 174, in train_loop
fetch_list=[loss, auc_var, batch_auc_var],
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/executor.py", line 565, in run
use_program_cache=use_program_cache)
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/executor.py", line 642, in _run
exe.run(program.desc, scope, 0, True, True, fetch_var_name)
paddle.fluid.core.EnforceNotMet: Invoke operator clip error.
Python Callstacks:
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1654, in append_op
attrs=kwargs.get("attrs", None))
File "/home/users/fuyan01/.jumbo/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/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/layers/nn.py", line 9495, in clip
outputs={"Out": out})
File "/home/users/fuyan01/zhiq/src/paddle_client/deepfm/deepfm.py", line 47, in feature_collector
feature = fluid.layers.clip(x=raw_feature, min=0.0, max=1.0)
File "/home/users/fuyan01/zhiq/src/paddle_client/deepfm/deepfm.py", line 112, in ctr_dnn_model
feature['dependency'], feature)
File "train.py", line 228, in train
train_info = dnn_model.ctr_dnn_model(args.embedding_size, args.sparse_feature_dim)
File "train.py", line 289, in <module>
train()
C++ Callstacks:
Input X(0)is not initialized at [/paddle/paddle/fluid/framework/operator.cc:1109]
PaddlePaddle Call Stacks:
0 0x7f826e59f200p void paddle::platform::EnforceNotMet::Init<char const*>(char const*, char const*, int) + 352
1 0x7f826e59f579p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 137
2 0x7f826f74af1fp paddle::framework::OperatorWithKernel::IndicateDataType(paddle::framework::ExecutionContext const&) const + 1343
3 0x7f826f74b10fp paddle::framework::OperatorWithKernel::GetExpectedKernelType(paddle::framework::ExecutionContext const&) const + 47
4 0x7f826f74d4f3p 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 + 243
5 0x7f826f74e194p 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 + 292
6 0x7f826f74c36bp 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&) + 267
7 0x7f826e706b7ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 158
8 0x7f826e709b5fp 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
9 0x7f826e58ffaep
10 0x7f826e5cefcep
11 0x7f8291da53e4p PyEval_EvalFrameEx + 25956
12 0x7f8291da6130p PyEval_EvalCodeEx + 2240
13 0x7f8291da44a1p PyEval_EvalFrameEx + 22049
14 0x7f8291da6130p PyEval_EvalCodeEx + 2240
15 0x7f8291da44a1p PyEval_EvalFrameEx + 22049
16 0x7f8291da6130p PyEval_EvalCodeEx + 2240
17 0x7f8291da44a1p PyEval_EvalFrameEx + 22049
18 0x7f8291da6130p PyEval_EvalCodeEx + 2240
19 0x7f8291da44a1p PyEval_EvalFrameEx + 22049
20 0x7f8291da6130p PyEval_EvalCodeEx + 2240
21 0x7f8291da6242p PyEval_EvalCode + 50
22 0x7f8291dc062cp
23 0x7f8291dc0700p PyRun_FileExFlags + 144
24 0x7f8291dc1c0cp PyRun_SimpleFileExFlags + 220
25 0x7f8291dd34ccp Py_Main + 3164
26 0x7f8291010bd5p __libc_start_main + 245
27 0x400669p
- 如果首先转换类型成float32,然后cast回到int64,仍然会报错:
raw_feature = fluid.layers.data(name=attr_name, shape=[1], dtype='int64')
feature = fluid.layers.clip(x=raw_feature, min=0.0, max=10.0)
emb_feature = fluid.layers.embedding(input=feature,size=[10, 8],
param_attr=fluid.ParamAttr(name=group_name,initializer=fluid.initializer.Normal(scale=0.3)))
Traceback (most recent call last):
File "train.py", line 289, in <module>
train()
File "train.py", line 249, in train
predictor, cost, test_program, label_offset)
File "train.py", line 174, in train_loop
fetch_list=[loss, auc_var, batch_auc_var],
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/executor.py", line 565, in run
use_program_cache=use_program_cache)
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/executor.py", line 642, in _run
exe.run(program.desc, scope, 0, True, True, fetch_var_name)
paddle.fluid.core.EnforceNotMet: Invoke operator cast error.
Python Callstacks:
File "/home/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/framework.py", line 1654, in append_op
attrs=kwargs.get("attrs", None))
File "/home/users/fuyan01/.jumbo/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/users/fuyan01/.jumbo/lib/python2.7/site-packages/paddle/fluid/layers/tensor.py", line 183, in cast
'out_dtype': out.dtype})
File "/home/users/fuyan01/zhiq/src/paddle_client/deepfm/deepfm.py", line 47, in feature_collector
cast_feature = fluid.layers.cast(raw_feature, dtype='float32')
File "/home/users/fuyan01/zhiq/src/paddle_client/deepfm/deepfm.py", line 114, in ctr_dnn_model
feature['dependency'], feature)
File "train.py", line 228, in train
train_info = dnn_model.ctr_dnn_model(args.embedding_size, args.sparse_feature_dim)
File "train.py", line 289, in <module>
train()
C++ Callstacks:
Input X(0)is not initialized at [/paddle/paddle/fluid/framework/operator.cc:1109]
PaddlePaddle Call Stacks:
0 0x7f950e318200p void paddle::platform::EnforceNotMet::Init<char const*>(char const*, char const*, int) + 352
1 0x7f950e318579p paddle::platform::EnforceNotMet::EnforceNotMet(std::__exception_ptr::exception_ptr, char const*, int) + 137
2 0x7f950f4c3f1fp paddle::framework::OperatorWithKernel::IndicateDataType(paddle::framework::ExecutionContext const&) const + 1343
3 0x7f950f4c410fp paddle::framework::OperatorWithKernel::GetExpectedKernelType(paddle::framework::ExecutionContext const&) const + 47
4 0x7f950e57d9f8p paddle::operators::CastOp::GetExpectedKernelType(paddle::framework::ExecutionContext const&) const + 40
5 0x7f950f4c64f3p 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 + 243
6 0x7f950f4c7194p 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 + 292
7 0x7f950f4c536bp 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&) + 267
8 0x7f950e47fb7ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 158
9 0x7f950e482b5fp 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 0x7f950e308faep
11 0x7f950e347fcep
12 0x7f9531b1e3e4p PyEval_EvalFrameEx + 25956
13 0x7f9531b1f130p PyEval_EvalCodeEx + 2240
14 0x7f9531b1d4a1p PyEval_EvalFrameEx + 22049
15 0x7f9531b1f130p PyEval_EvalCodeEx + 2240
16 0x7f9531b1d4a1p PyEval_EvalFrameEx + 22049
17 0x7f9531b1f130p PyEval_EvalCodeEx + 2240
18 0x7f9531b1d4a1p PyEval_EvalFrameEx + 22049
19 0x7f9531b1f130p PyEval_EvalCodeEx + 2240
20 0x7f9531b1d4a1p PyEval_EvalFrameEx + 22049
21 0x7f9531b1f130p PyEval_EvalCodeEx + 2240
22 0x7f9531b1f242p PyEval_EvalCode + 50
23 0x7f9531b3962cp
24 0x7f9531b39700p PyRun_FileExFlags + 144
25 0x7f9531b3ac0cp PyRun_SimpleFileExFlags + 220
26 0x7f9531b4c4ccp Py_Main + 3164
27 0x7f9530d89bd5p __libc_start_main + 245
28 0x400669p