重构后,出错信息/调用栈信息是否可以进一步改善
Created by: lcy-seso
在写 Op 过程中遇到一些自己实现的bug,引起单测挂掉,但目前的栈信息依然不是非常容易理解,不知是否可以进一步改善。
下午遇到的一个例子:
在写 Op 反向时,为前向增加了一个输出,供反向直接使用,但是忘记在前向 Op 的inferShape
阶段调用 Resize
设置输出维度,报错信息如下,还是过于晦涩。
Start testing: Sep 13 15:48 CST
----------------------------------------------------------
150/155 Testing: test_softmax_with_cross_entropy_op
150/155 Test: test_softmax_with_cross_entropy_op
Command: "/bin/env" "PYTHONPATH=/home/caoying/paddle_codes/paddle_github/build/python/build/lib-python" "python2" "test_softmax_with_cross_entropy_op.py"
Directory: /home/caoying/paddle_codes/paddle_github/python/paddle/v2/framework/tests
"test_softmax_with_cross_entropy_op" start time: Sep 13 15:48 CST
Output:
----------------------------------------------------------
.E
======================================================================
ERROR: test_check_output (__main__.TestSoftmaxWithCrossEntropyOp)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_softmax_with_cross_entropy_op.py", line 33, in test_check_output
self.check_output()
File "/home/caoying/paddle_codes/paddle_github/python/paddle/v2/framework/tests/op_test.py", line 206, in check_output
self.check_output_with_place(place)
File "/home/caoying/paddle_codes/paddle_github/python/paddle/v2/framework/tests/op_test.py", line 180, in check_output_with_place
self.op.run(self.scope, ctx)
RuntimeError: ptr_ should not be null
Insufficient CPU memory to allocation. at [/home/caoying/paddle_codes/paddle_github/paddle/framework/tensor.h:144]
PaddlePaddle Call Stacks:
0 0x7fe3a71d860fp _ZN6paddle8platform13EnforceNotMetC1ENSt15__exception_ptr13exception_ptrEPKci + 515
1 0x7fe3a71f5b6cp _ZN6paddle9framework6Tensor15PlaceholderImplIfNS_8platform8CPUPlaceEEC2ES4_m + 386
2 0x7fe3a71eb549p _ZN6paddle9framework6Tensor12mutable_dataIfEEPT_N5boost7variantINS_8platform8GPUPlaceENS7_8CPUPlaceENS5_6detail7variant5void_ESC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_SC_EE + 495
3 0x7fe3a7288c19p _ZNK6paddle9operators29SoftmaxWithCrossEntropyKernelINS_8platform8CPUPlaceEfE7ComputeERKNS_9framework16ExecutionContextE + 279
4 0x7fe3a723b501p _ZNK6paddle9framework18OperatorWithKernel3RunERKNS0_5ScopeERKNS_8platform13DeviceContextE + 155
5 0x7fe3a71f83f2p _ZZN8pybind1112cpp_functionC1IvN6paddle9framework12OperatorBaseEIRKNS3_5ScopeERKNS2_8platform13DeviceContextEEINS_4nameENS_9is_methodENS_7siblingEEEEMT0_KFT_DpT1_EDpRKT2_ENKUlPKS4_S7_SB_E_clESQ_S7_SB_ + 118
6 0x7fe3a721dff7p _ZN8pybind116detail15argument_loaderIIPKN6paddle9framework12OperatorBaseERKNS3_5ScopeERKNS2_8platform13DeviceContextEEE9call_implIvRZNS_12cpp_functionC1IvS4_IS9_SD_EINS_4nameENS_9is_methodENS_7siblingEEEEMT0_KFT_DpT1_EDpRKT2_EUlS6_S9_SD_E_ILm0ELm1ELm2EEEET_OT0_NS0_14index_sequenceIIXspT1_EEEE + 119
7 0x7fe3a7211a50p _ZN8pybind116detail15argument_loaderIIPKN6paddle9framework12OperatorBaseERKNS3_5ScopeERKNS2_8platform13DeviceContextEEE4callIvRZNS_12cpp_functionC1IvS4_IS9_SD_EINS_4nameENS_9is_methodENS_7siblingEEEEMT0_KFT_DpT1_EDpRKT2_EUlS6_S9_SD_E_EENSt9enable_ifIXsrSt7is_voidIT_E5valueENS0_9void_typeEE4typeEOT0_ + 52
8 0x7fe3a72061c8p _ZZN8pybind1112cpp_function10initializeIZNS0_C1IvN6paddle9framework12OperatorBaseEIRKNS4_5ScopeERKNS3_8platform13DeviceContextEEINS_4nameENS_9is_methodENS_7siblingEEEEMT0_KFT_DpT1_EDpRKT2_EUlPKS5_S8_SC_E_vISR_S8_SC_EISD_SE_SF_EEEvOSH_PFSG_SJ_ESP_ENKUlRNS_6detail13function_callEE1_clESY_ + 186
9 0x7fe3a7206495p _ZZN8pybind1112cpp_function10initializeIZNS0_C1IvN6paddle9framework12OperatorBaseEIRKNS4_5ScopeERKNS3_8platform13DeviceContextEEINS_4nameENS_9is_methodENS_7siblingEEEEMT0_KFT_DpT1_EDpRKT2_EUlPKS5_S8_SC_E_vISR_S8_SC_EISD_SE_SF_EEEvOSH_PFSG_SJ_ESP_ENUlRNS_6detail13function_callEE1_4_FUNESY_ + 29
10 0x7fe3a71e300bp _ZN8pybind1112cpp_function10dispatcherEP7_objectS2_S2_ + 2448
11 0x7fe3ddc663e4p PyEval_EvalFrameEx + 25956
12 0x7fe3ddc65c56p PyEval_EvalFrameEx + 24022
----------------------------------------------------------------------
Ran 2 tests in 0.008s
FAILED (errors=1)
<end of output>
Test time = 1.15 sec
----------------------------------------------------------
Test Failed.
"test_softmax_with_cross_entropy_op" end time: Sep 13 15:48 CST
"test_softmax_with_cross_entropy_op" time elapsed: 00:00:01
----------------------------------------------------------
End testing: Sep 13 15:48 CST