Op重构后目前的 gradient check 出错输出信息太简陋
Created by: lcy-seso
实现 Op 时难免出现梯度检查不过的情况,发现目前 Gradient Check 的输出信息还是过于简陋,下面是出错信息。
可以输出更多信息,比如:一共多少维度,多少维度有diff,多少维度没有diff,diff值有多少。方便对整体出错情况有一个判断。
.F
======================================================================
FAIL: 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 207, 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 200, in check_output_with_place
"output name: " + out_name + " has diff.")
AssertionError: output name: Loss has diff.