# NOTE(zhiqu): reshape inputs['Alpha'] from [1, 100] to [1, 100, 1, 1] since np operands could not be broadcast together with shapes (2,100,3,4) (1,100)
ifself.attrs=={'mode':"channel"}:
self.inputs['Alpha']=np.reshape(
self.inputs['Alpha'],
[1,self.x_shape[1]]+[1]*len(self.x_shape[2:]))
out_np=np.maximum(self.inputs['X'],0.)
out_np=out_np+np.minimum(self.inputs['X'],
0.)*self.inputs['Alpha']
@ -64,7 +70,7 @@ class PReluTest(OpTest):
self.outputs={'Out':out_np}
definit_input_shape(self):
self.x_shape=(2,100,3,4)
self.x_shape=[2,100,3,4]
definit_attr(self):
self.attrs={'mode':"channel"}
@ -81,7 +87,7 @@ class PReluTest(OpTest):
)
classTestModeAll(PReluTest):
definit_input_shape(self):
self.x_shape=(2,3,4,5)
self.x_shape=[2,3,4,5]
definit_attr(self):
self.attrs={'mode':"all"}
@ -89,7 +95,61 @@ class TestModeAll(PReluTest):
classTestModeElt(PReluTest):
definit_input_shape(self):
self.x_shape=(3,2,5,10)
self.x_shape=[3,2,5,10]
definit_attr(self):
self.attrs={'mode':"element"}
@skip_check_grad_ci(
reason="[skip shape check] Input(Alpha) must be 1-D and only has one data in 'all' mode"
)
classTestModeAllRank3(PReluTest):
definit_input_shape(self):
self.x_shape=[1,200,3]
definit_attr(self):
self.attrs={'mode':"all"}
@skip_check_grad_ci(
reason="[skip shape check] Input(Alpha) must be 1-D and only has one data in 'all' mode"