提交 e53d5967 编写于 作者: G GaoWei8 提交者: Tao Luo

Remove self-set accuracy parameters of op tests: max_relative_error (#21816)

* Remove self-set accuracy parameters of op tests: max_relative_erro
test=develop

* fix error
test=develop
上级 13958284
...@@ -196,7 +196,6 @@ class TestLstmpOp(LstmTest.TestLstmOp): ...@@ -196,7 +196,6 @@ class TestLstmpOp(LstmTest.TestLstmOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'Weight', 'ProjWeight', 'Bias'], ['Projection'], ['Input', 'Weight', 'ProjWeight', 'Bias'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
check_dygraph=False) check_dygraph=False)
...@@ -216,7 +215,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -216,7 +215,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
['Input', 'Weight', 'ProjWeight', 'Bias', 'H0', 'C0'], ['Input', 'Weight', 'ProjWeight', 'Bias', 'H0', 'C0'],
['Projection'], ['Projection'],
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
max_relative_error=1e-2,
check_dygraph=False) check_dygraph=False)
def test_check_grad_ingore_bias(self): def test_check_grad_ingore_bias(self):
...@@ -227,7 +225,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -227,7 +225,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'ProjWeight', 'Weight'], ['Projection'], ['Input', 'ProjWeight', 'Weight'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('Bias'), no_grad_set=set('Bias'),
check_dygraph=False) check_dygraph=False)
...@@ -240,7 +237,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -240,7 +237,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'ProjWeight', 'Bias'], ['Projection'], ['Input', 'ProjWeight', 'Bias'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('Weight'), no_grad_set=set('Weight'),
check_dygraph=False) check_dygraph=False)
...@@ -253,7 +249,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -253,7 +249,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'Weight', 'Bias'], ['Projection'], ['Input', 'Weight', 'Bias'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('ProjWeight'), no_grad_set=set('ProjWeight'),
check_dygraph=False) check_dygraph=False)
...@@ -266,7 +261,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -266,7 +261,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Weight', 'ProjWeight', 'Bias'], ['Projection'], ['Weight', 'ProjWeight', 'Bias'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('Input'), no_grad_set=set('Input'),
check_dygraph=False) check_dygraph=False)
...@@ -279,7 +273,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -279,7 +273,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'Weight', 'ProjWeight', 'Bias', 'C0'], ['Projection'], ['Input', 'Weight', 'ProjWeight', 'Bias', 'C0'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('H0'), no_grad_set=set('H0'),
check_dygraph=False) check_dygraph=False)
...@@ -292,7 +285,6 @@ class TestLstmpOpHasInitial(TestLstmpOp): ...@@ -292,7 +285,6 @@ class TestLstmpOpHasInitial(TestLstmpOp):
(N, self.D)).astype('float64') (N, self.D)).astype('float64')
self.check_grad( self.check_grad(
['Input', 'Weight', 'ProjWeight', 'Bias', 'H0'], ['Projection'], ['Input', 'Weight', 'ProjWeight', 'Bias', 'H0'], ['Projection'],
max_relative_error=1e-2,
numeric_grad_delta=0.0000005, numeric_grad_delta=0.0000005,
no_grad_set=set('C0'), no_grad_set=set('C0'),
check_dygraph=False) check_dygraph=False)
......
...@@ -63,27 +63,15 @@ class TestRowConvOp1(OpTest): ...@@ -63,27 +63,15 @@ class TestRowConvOp1(OpTest):
self.check_output(check_dygraph=False) self.check_output(check_dygraph=False)
def test_check_grad_normal(self): def test_check_grad_normal(self):
self.check_grad( self.check_grad(['X', 'Filter'], 'Out', check_dygraph=False)
['X', 'Filter'],
'Out',
max_relative_error=0.05,
check_dygraph=False)
def test_check_grad_ignore_x(self): def test_check_grad_ignore_x(self):
self.check_grad( self.check_grad(
['Filter'], ['Filter'], 'Out', no_grad_set=set('X'), check_dygraph=False)
'Out',
max_relative_error=0.05,
no_grad_set=set('X'),
check_dygraph=False)
def test_check_grad_ignore_wt(self): def test_check_grad_ignore_wt(self):
self.check_grad( self.check_grad(
['X'], ['X'], 'Out', no_grad_set=set('Filter'), check_dygraph=False)
'Out',
max_relative_error=0.05,
no_grad_set=set('Filter'),
check_dygraph=False)
class TestRowConvOp2(OpTest): class TestRowConvOp2(OpTest):
...@@ -169,26 +157,14 @@ class TestRowOpWithTensorInput(OpTest): ...@@ -169,26 +157,14 @@ class TestRowOpWithTensorInput(OpTest):
def test_check_grad_ignore_x(self): def test_check_grad_ignore_x(self):
self.check_grad( self.check_grad(
['Filter'], ['Filter'], 'Out', no_grad_set=set('X'), check_dygraph=False)
'Out',
max_relative_error=0.05,
no_grad_set=set('X'),
check_dygraph=False)
def test_check_grad_normal(self): def test_check_grad_normal(self):
self.check_grad( self.check_grad(['X', 'Filter'], 'Out', check_dygraph=False)
['X', 'Filter'],
'Out',
max_relative_error=0.05,
check_dygraph=False)
def test_check_grad_ignore_wt(self): def test_check_grad_ignore_wt(self):
self.check_grad( self.check_grad(
['X'], ['X'], 'Out', no_grad_set=set('Filter'), check_dygraph=False)
'Out',
max_relative_error=0.05,
no_grad_set=set('Filter'),
check_dygraph=False)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册