-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpRegistry::CreateOp调用,输入/输出名字写错,报错信息难以理解 #3899
Comments
遇到过同样的问题,,打了一堆log来定位出错的地方 |
@reyoung 用的是最新的 |
我也遇到这个问题,使用的也是最新分枝,和 @Xreki 的情形相同。 |
我又一次在 我在写 AddOutput("Y", "The activated output matrix of FC operator"); 引用处也都改成了 136: Test command: /bin/env "PYTHONPATH=/home/liuyiqun01/github/Paddle/build_paddle/build/python/build/lib-python" "python2" "test_fc_op.py"
136: Test timeout computed to be: 9.99988e+06
136: Run
1/1 Test #136: test_fc_op .......................***Exception: SegFault 11.22 sec 经过几番调试,发现是python测试程序里面输出的名字没改过来,功能是
发现有两个 |
我们是否可以一起努力,保证此 PR 的尽快merge:#3452 |
另一个和命名相关的小问题 :#3976 |
@reyoung 我查到产生上述log的根源了,是由
45 PADDLE_ENFORCE_EQ(
46 // x_mat_dims[1], y_mat_dims[0],
47 1, 2,
48 "First matrix's width must be equal with second matrix's height.");
我们设定的 再来说下, OperatorBase::OperatorBase(const std::string& type,
const VariableNameMap& inputs,
const VariableNameMap& outputs,
const AttributeMap& attrs)
: type_(type), inputs_(inputs), outputs_(outputs), attrs_(attrs) {
GenerateTemporaryNames();
CheckAllInputOutputSet();
} 其实在 void OperatorBase::CheckAllInputOutputSet() const {
auto& info_map = OpInfoMap::Instance();
auto* op_info = info_map.GetNullable(Type());
if (op_info == nullptr || op_info->proto_ == nullptr) return;
for (auto& in : op_info->Proto().inputs()) {
PADDLE_ENFORCE(inputs_.find(in.name()) != inputs_.end(),
"Type %s's input %s is not set", Type(), in.name());
}
for (auto& out : op_info->Proto().outputs()) {
PADDLE_ENFORCE(outputs_.find(out.name()) != outputs_.end(),
"Type %s's output %s is not set", Type(), out.name());
}
} 没错,当我们输入/输出的key配置错误时,就是挂在这两个 |
@Superjom 说 #include "gtest/gtest.h"
#include "paddle/platform/enforce.h"
TEST(ENFORCE, Failure) {
PADDLE_ENFORCE(false, "Example to show the behavior when enforce is failed.");
} 执行单测 $ make test ARGS="-R enforce_failure_test -V"
Running tests...
UpdateCTestConfiguration from :/home/liuyiqun01/github/Paddle/build_paddle/build/DartConfiguration.tcl
UpdateCTestConfiguration from :/home/liuyiqun01/github/Paddle/build_paddle/build/DartConfiguration.tcl
Test project /home/liuyiqun01/github/Paddle/build_paddle/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 84
Start 84: enforce_failure_test
84: Test command: /home/liuyiqun01/github/Paddle/build_paddle/build/paddle/platform/enforce_failure_test
84: Test timeout computed to be: 9.99988e+06
84: Running main() from gtest_main.cc
84: [==========] Running 1 test from 1 test case.
84: [----------] Global test environment set-up.
84: [----------] 1 test from ENFORCE
84: [ RUN ] ENFORCE.Failure
84: unknown file: Failure
84: C++ exception with description "basic_string::_S_construct null not valid" thrown in the test body.
84: [ FAILED ] ENFORCE.Failure (1 ms)
84: [----------] 1 test from ENFORCE (1 ms total)
84:
84: [----------] Global test environment tear-down
84: [==========] 1 test from 1 test case ran. (1 ms total)
84: [ PASSED ] 0 tests.
84: [ FAILED ] 1 test, listed below:
84: [ FAILED ] ENFORCE.Failure
84:
84: 1 FAILED TEST
1/1 Test #84: enforce_failure_test .............***Failed 0.00 sec
0% tests passed, 1 tests failed out of 1
Total Test time (real) = 0.01 sec
The following tests FAILED:
84 - enforce_failure_test (Failed)
Errors while running CTest
make: *** [test] Error 8 |
136: ERROR: test_check_output (__main__.TestFCOp)
136: ----------------------------------------------------------------------
136: Traceback (most recent call last):
136: File "test_fc_op.py", line 40, in test_check_output
136: self.check_output()
136: File "/home/liuyiqun01/github/Paddle/python/paddle/v2/framework/tests/op_test.py", line 203, in check_output
136: self.check_output_with_place(place)
136: File "/home/liuyiqun01/github/Paddle/python/paddle/v2/framework/tests/op_test.py", line 171, in check_output_with_place
136: self.op = create_op(self.scope, self.op_type, self.inputs, self.outputs)
136: File "/home/liuyiqun01/github/Paddle/python/paddle/v2/framework/tests/op_test.py", line 41, in create_op
136: return Operator(op_type, **kwargs)
136: File "/home/liuyiqun01/github/Paddle/build_paddle/build/python/build/lib-python/paddle/v2/framework/op.py", line 172, in __call__
136: return self.get_op_info(t).method(**kwargs)
136: File "/home/liuyiqun01/github/Paddle/build_paddle/build/python/build/lib-python/paddle/v2/framework/op.py", line 140, in __impl__
136: return core.Operator.create(opdesc.SerializeToString())
136: RuntimeError: Type mul's input Y is not set at [/home/liuyiqun01/github/Paddle/paddle/framework/operator.cc:167]
136: PaddlePaddle Call Stacks:
136: 0 0x7fe466e44527p _ZN6paddle8platform13EnforceNotMetC2ENSt15__exception_ptr13exception_ptrEPKci + 663
136: 1 0x7fe4683b55fap _ZNK6paddle9framework12OperatorBase22CheckAllInputOutputSetEv + 426
... |
FCOp
,通过组合MulOp
,Row
,RowwiseAddOp
,SoftmaxOp
等实现,在C++实现中通过调用OpRegistry::CreateOp
来创建相应的Op
。FCOp
的输入为X
和W
,MulOp
的输入为X
和Y
,在创建MulOp
将输入误写为:单测时报错信息如下:
这个报错信息太难以理解了,花了很多时间才发现是
MulOp
输入的名字写错了,正确的写法应该是:重构后的Paddle,需要更友好、直观的错误提示。
The text was updated successfully, but these errors were encountered: