Skip to content

Commit e819f1b

Browse files
committed
Add unittests to check channelwise add
1 parent 2381249 commit e819f1b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

python/paddle/fluid/tests/unittests/test_elementwise_add_op.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,5 +252,25 @@ def init_axis(self):
252252
self.axis = 1
253253

254254

255+
class TestElementwiseAddOp_channelwise_add(TestElementwiseAddOp):
256+
def init_input_output(self):
257+
self.x = np.random.rand(3, 20, 20).astype(self.dtype)
258+
self.y = np.random.rand(3, 1, 1).astype(self.dtype)
259+
self.out = self.x + self.y
260+
261+
def init_axis(self):
262+
self.axis = -1
263+
264+
265+
class TestFP16ElementwiseAddOp_channelwise_add(TestFP16ElementwiseAddOp):
266+
def init_input_output(self):
267+
self.x = np.random.rand(3, 10, 20).astype(self.dtype)
268+
self.y = np.random.rand(3, 1, 1).astype(self.dtype)
269+
self.out = self.x + self.y
270+
271+
def init_axis(self):
272+
self.axis = -1
273+
274+
255275
if __name__ == '__main__':
256276
unittest.main()

0 commit comments

Comments
 (0)