首页 Paddle框架 帖子详情
paddle.fluid.core.EnforceNotMet: Enforce failed. Expected x_dims[i + axis] == y_dims[i], but received x_dims[i + axis]:1 != y_dims[i]:72.
收藏
快速回复
Paddle框架 问答深度学习 1106 3
paddle.fluid.core.EnforceNotMet: Enforce failed. Expected x_dims[i + axis] == y_dims[i], but received x_dims[i + axis]:1 != y_dims[i]:72.
收藏
快速回复
Paddle框架 问答深度学习 1106 3

pytorch模型能够转paddle,paddle运行的时候遇到错误。网络用到了SENet的
x * sigmoid(x_squeeze).其中:
x.shape=(1,128,72,128)
x_squeeze.shape=(1,128,1,1)
在pytorch当中能够运行,paddle当中报如下错误
报错完整信息:
File "/usr/local/lib/python2.7/dist-packages/paddle/fluid/executor.py", line 591, in run
exe.run(program.desc, scope, 0, True, True)
paddle.fluid.core.EnforceNotMet: Enforce failed. Expected x_dims[i + axis] == y_dims[i], but received x_dims[i + axis]:1 != y_dims[i]:72.
Broadcast dimension mismatch. at [/home/jianwang/test/paddle/Paddle-dev/Paddle/paddle/fluid/operators/elementwise/elementwise_op_function.h:63]
PaddlePaddle Call Stacks:
0 0x7ff16e64cc5dp void paddle::platform::EnforceNotMet::Init<std::cxx11::basic_string<char, std::char_traits, std::allocator > >(std::cxx11::basic_string<char, std::char_traits, std::allocator >, char const*, int) + 509
1 0x7ff16e64df32p paddle::platform::EnforceNotMet::EnforceNotMet<char const*, char const*, char const*, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator >, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator > >(char const*, int, char const*, char const*, char const*, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator >, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator >, std::cxx11::basic_string<char, std::char_traits, std::allocator >) + 162
2 0x7ff16eb98e02p paddle::operators::get_mid_dims(paddle::framework::DDim const&, paddle::framework::DDim const&, int, int*, int*, int*) + 418
3 0x7ff16eb9ef8dp void paddle::operators::ElementwiseComputeEx<paddle::operators::MulFunctor, paddle::platform::CPUDeviceContext, float, float>(paddle::framework::ExecutionContext const&, paddle::framework::Tensor const*, paddle::framework::Tensor const*, int, paddle::operators::MulFunctor, paddle::framework::Tensor*) + 1197
4 0x7ff16fa64684p paddle::operators::ElementwiseMulKernel<paddle::platform::CPUDeviceContext, float>::Compute(paddle::framework::ExecutionContext const&) const + 644
5 0x7ff16fa64b3fp std::Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CPUPlace, false, 0ul, paddle::operators::ElementwiseMulKernel<paddle::platform::CPUDeviceContext, float>, paddle::operators::ElementwiseMulKernel<paddle::platform::CPUDeviceContext, double>, paddle::operators::ElementwiseMulKernel<paddle::platform::CPUDeviceContext, int>, paddle::operators::ElementwiseMulKernel<paddle::platform::CPUDeviceContext, long> >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::M_invoke(std::Any_data const&, paddle::framework::ExecutionContext const&) + 47
6 0x7ff16ff3b500p 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 + 656
7 0x7ff16ff35aadp 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&) + 317
8 0x7ff16e791f0ep paddle::framework::Executor::RunPreparedContext(paddle::framework::ExecutorPrepareContext*, paddle::framework::Scope*, bool, bool, bool) + 302
9 0x7ff16e79453ap paddle::framework::Executor::Run(paddle::framework::ProgramDesc const&, paddle::framework::Scope*, int, bool, bool) + 218
10 0x7ff16e61ff18p
11 0x7ff16e678aedp
12 0x4c5326p PyEval_EvalFrameEx + 37958
13 0x4b9b66p PyEval_EvalCodeEx + 774
14 0x4c1f56p PyEval_EvalFrameEx + 24694
15 0x4b9b66p PyEval_EvalCodeEx + 774
16 0x4c17c6p PyEval_EvalFrameEx + 22758
17 0x4c141fp PyEval_EvalFrameEx + 21823
18 0x4b9b66p PyEval_EvalCodeEx + 774
19 0x4eb69fp
20 0x4e58f2p PyRun_FileExFlags + 130
21 0x54aae7p
22 0x4c1e1ep PyEval_EvalFrameEx + 24382
23 0x4b9b66p PyEval_EvalCodeEx + 774
24 0x4c17c6p PyEval_EvalFrameEx + 22758
25 0x4c141fp PyEval_EvalFrameEx + 21823
26 0x4b9b66p PyEval_EvalCodeEx + 774
27 0x4eb69fp
28 0x4e58f2p PyRun_FileExFlags + 130
29 0x4e41a6p PyRun_SimpleFileExFlags + 390
30 0x4938cep Py_Main + 1358
31 0x7ff1de44c830p __libc_start_main + 240
32 0x493299p _start + 41

0
收藏
回复
全部评论(3)
时间顺序
Feiyu Chan
#2 回复于2019-12

请问使用的 paddle 版本是?更新到 1.6.1 或者 1.6.2 应该就可以了。因为 paddle 的 broadcast 规则和 pytorch 有点不同,具体可以参考这个。

http://wiki.baidu.com/pages/viewpage.action?pageId=1006176252

不过更新到 1.6 之后就支持这种 broadcast 了。

0
回复
AIStudio791114
#3 回复于2019-12

请问使用的 paddle 版本是?更新到 1.6.1 或者 1.6.2 应该就可以了。因为 paddle 的 broadcast 规则和 pytorch 有点不同,具体可以参考这个。

http://wiki.baidu.com/pages/viewpage.action?pageId=1006176252

不过更新到 1.6 之后就支持这种 broadcast 了。
你好,确实是因为版本过低了,另外老哥你怎么看出我也是baidu的哈哈

0
回复
靠北的窗
#4 回复于2020-07

我用paddle fluid 写的模型,但在C++做推理的时候出现这个问题,有没有大神可以解决呢

Error Message Summary:
----------------------
InvalidArgumentError: input width should be equal to weight height, but input width is 2304, weight height is 2308.
[Hint: Expected i_dims[1] == w_dims[0][0], but received i_dims[1]:2304 != w_dims[0][0]:2308.] at (D:\1.8.2\paddle\paddle\fluid\operators\fused\fusion_repeated_fc_relu_op.cc:64)

0
回复
需求/bug反馈?一键提issue告诉我们
发现bug?如果您知道修复办法,欢迎提pr直接参与建设飞桨~
在@后输入用户全名并按空格结束,可艾特全站任一用户