File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,16 @@ def test_fp16(self):
336
336
paddle .disable_static ()
337
337
338
338
339
+ class TestBceLossOp_ZeroSize (TestBceLossOp ):
340
+ def init_test_cast (self ):
341
+ self .shape = [0 , 1 , 2 ]
342
+
343
+
344
+ class TestBceLossOp_ZeroSize2 (TestBceLossOp ):
345
+ def init_test_cast (self ):
346
+ self .shape = [0 ]
347
+
348
+
339
349
if __name__ == "__main__" :
340
350
paddle .enable_static ()
341
351
unittest .main ()
Original file line number Diff line number Diff line change 15
15
import unittest
16
16
17
17
import numpy as np
18
+ from op_test import OpTest
18
19
from scipy import special
19
20
20
21
import paddle
@@ -70,5 +71,36 @@ def init_dtype_type(self):
70
71
self .dtype = "float32"
71
72
72
73
74
+ class TestGammaincOp_ZeroSize (OpTest ):
75
+ def setUp (self ):
76
+ self .op_type = 'gammaincc'
77
+ self .python_api = paddle .gammainc
78
+ self .init_dtype_type ()
79
+ self .init_shape ()
80
+ self .x = np .random .random (self .shape ).astype (self .dtype ) + 1
81
+ self .y = np .random .random (self .shape ).astype (self .dtype ) + 1
82
+ self .inputs = {'x' : self .x , 'y' : self .y }
83
+ out = ref_gammainc (self .x , self .y )
84
+ self .outputs = {'out' : out }
85
+
86
+ def init_shape (self ):
87
+ self .shape = (0 , 40 )
88
+
89
+ def init_dtype_type (self ):
90
+ self .dtype = np .float64
91
+
92
+ def test_check_output (self ):
93
+ self .check_output ()
94
+
95
+ def test_check_grad (self ):
96
+ self .check_grad (['y' ], 'out' )
97
+
98
+
99
+ class TestGammaincOp_ZeroSize2 (TestGammaincOp_ZeroSize ):
100
+
101
+ def init_shape (self ):
102
+ self .shape = (0 ,)
103
+
104
+
73
105
if __name__ == "__main__" :
74
106
unittest .main ()
You can’t perform that action at this time.
0 commit comments