提交 dfec1df1 编写于 作者: K Kexin Zhao

address comments

上级 8ebfc153
......@@ -63,10 +63,11 @@ def conv2d_forward_naive(input, filter, group, conv_param):
class TestConv2dOp(OpTest):
def setUp(self):
self.op_type = "conv2d"
self.use_cudnn = False
self.use_mkldnn = False
self.dtype = np.float32
self.init_op_type()
self.init_kernel_type()
self.init_group()
self.init_dilation()
self.init_test_case()
......@@ -165,8 +166,8 @@ class TestConv2dOp(OpTest):
def init_group(self):
self.groups = 1
def init_op_type(self):
self.op_type = "conv2d"
def init_kernel_type(self):
pass
class TestWithPad(TestConv2dOp):
......@@ -238,15 +239,13 @@ class TestWithInput1x1Filter1x1(TestConv2dOp):
#----------------Conv2dCUDNN----------------
class TestCUDNN(TestConv2dOp):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNN(TestConv2dOp):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -257,15 +256,13 @@ class TestFP16CUDNN(TestConv2dOp):
class TestCUDNNWithPad(TestWithPad):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNNWithPad(TestWithPad):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -276,15 +273,13 @@ class TestFP16CUDNNWithPad(TestWithPad):
class TestCUDNNWithStride(TestWithStride):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNNWithStride(TestWithStride):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -295,15 +290,13 @@ class TestFP16CUDNNWithStride(TestWithStride):
class TestCUDNNWithGroup(TestWithGroup):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNNWithGroup(TestWithGroup):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -314,15 +307,13 @@ class TestFP16CUDNNWithGroup(TestWithGroup):
class TestCUDNNWith1x1(TestWith1x1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNNWith1x1(TestWith1x1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -333,15 +324,13 @@ class TestFP16CUDNNWith1x1(TestWith1x1):
class TestCUDNNWithInput1x1Filter1x1(TestWithInput1x1Filter1x1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
class TestFP16CUDNNWithInput1x1Filter1x1(TestWithInput1x1Filter1x1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "conv2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -384,21 +373,18 @@ class TestDepthwiseConv2(TestConv2dOp):
#----------------Conv2dMKLDNN----------------
class TestMKLDNN(TestConv2dOp):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "conv2d"
class TestMKLDNNWithPad(TestWithPad):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "conv2d"
class TestMKLDNNWithStride(TestWithStride):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "conv2d"
if __name__ == '__main__':
......
......@@ -78,12 +78,13 @@ def avg_pool2D_forward_naive(x,
class TestPool2d_Op(OpTest):
def setUp(self):
self.op_type = "pool2d"
self.use_cudnn = False
self.use_mkldnn = False
self.dtype = np.float32
self.init_test_case()
self.init_global_pool()
self.init_op_type()
self.init_kernel_type()
self.init_pool_type()
self.init_ceil_mode()
if self.global_pool:
......@@ -131,8 +132,8 @@ class TestPool2d_Op(OpTest):
self.strides = [1, 1]
self.paddings = [0, 0]
def init_op_type(self):
self.op_type = "pool2d"
def init_kernel_type(self):
pass
def init_pool_type(self):
self.pool_type = "avg"
......@@ -152,9 +153,6 @@ class TestCase1(TestPool2d_Op):
self.strides = [1, 1]
self.paddings = [0, 0]
def init_op_type(self):
self.op_type = "pool2d"
def init_pool_type(self):
self.pool_type = "avg"
self.pool2D_forward_naive = avg_pool2D_forward_naive
......@@ -170,9 +168,6 @@ class TestCase2(TestPool2d_Op):
self.strides = [1, 1]
self.paddings = [1, 1]
def init_op_type(self):
self.op_type = "pool2d"
def init_pool_type(self):
self.pool_type = "avg"
self.pool2D_forward_naive = avg_pool2D_forward_naive
......@@ -182,27 +177,18 @@ class TestCase2(TestPool2d_Op):
class TestCase3(TestPool2d_Op):
def init_op_type(self):
self.op_type = "pool2d"
def init_pool_type(self):
self.pool_type = "max"
self.pool2D_forward_naive = max_pool2D_forward_naive
class TestCase4(TestCase1):
def init_op_type(self):
self.op_type = "pool2d"
def init_pool_type(self):
self.pool_type = "max"
self.pool2D_forward_naive = max_pool2D_forward_naive
class TestCase5(TestCase2):
def init_op_type(self):
self.op_type = "pool2d"
def init_pool_type(self):
self.pool_type = "max"
self.pool2D_forward_naive = max_pool2D_forward_naive
......@@ -210,15 +196,13 @@ class TestCase5(TestCase2):
#--------------------test pool2d--------------------
class TestCUDNNCase1(TestPool2d_Op):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase1(TestPool2d_Op):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -229,15 +213,13 @@ class TestFP16CUDNNCase1(TestPool2d_Op):
class TestCUDNNCase2(TestCase1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase2(TestCase1):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -248,15 +230,13 @@ class TestFP16CUDNNCase2(TestCase1):
class TestCUDNNCase3(TestCase2):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase3(TestCase2):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -267,15 +247,13 @@ class TestFP16CUDNNCase3(TestCase2):
class TestCUDNNCase4(TestCase3):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase4(TestCase3):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -286,15 +264,13 @@ class TestFP16CUDNNCase4(TestCase3):
class TestCUDNNCase5(TestCase4):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase5(TestCase4):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -305,15 +281,13 @@ class TestFP16CUDNNCase5(TestCase4):
class TestCUDNNCase6(TestCase5):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
class TestFP16CUDNNCase6(TestCase5):
def init_op_type(self):
def init_kernel_type(self):
self.use_cudnn = True
self.op_type = "pool2d"
self.dtype = np.float16
def test_check_output(self):
......@@ -345,39 +319,33 @@ class TestCeilModeCase4(TestCase2):
#--------------------test pool2d MKLDNN--------------------
class TestMKLDNNCase1(TestPool2d_Op):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
class TestMKLDNNCase2(TestCase1):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
class TestMKLDNNCase3(TestCase2):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
class TestMKLDNNCase4(TestCase3):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
class TestMKLDNNCase5(TestCase4):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
class TestMKLDNNCase6(TestCase5):
def init_op_type(self):
def init_kernel_type(self):
self.use_mkldnn = True
self.op_type = "pool2d"
if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册