From 29baca0dd8bc8cf2bceb8f8acd092690d7131974 Mon Sep 17 00:00:00 2001 From: baojun <32073718+baojun-nervana@users.noreply.github.com> Date: Wed, 29 May 2019 00:18:32 -0700 Subject: [PATCH] add depthwise_conv2d op to ngraph engine (#17454) * add depthwise_conv2d test=develop * use cpu for ngraph test=develop --- paddle/fluid/operators/ngraph/ops/conv2d_op.h | 1 + .../unittests/ngraph/test_conv2d_ngraph_op.py | 35 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/ngraph/ops/conv2d_op.h b/paddle/fluid/operators/ngraph/ops/conv2d_op.h index be766ebeb47..b8ad7491d57 100644 --- a/paddle/fluid/operators/ngraph/ops/conv2d_op.h +++ b/paddle/fluid/operators/ngraph/ops/conv2d_op.h @@ -239,3 +239,4 @@ void BuildConv2dGradNode( REGISTER_NG_OP(conv2d, BuildConv2dNode); REGISTER_NG_OP(conv2d_grad, BuildConv2dGradNode); +REGISTER_NG_OP(depthwise_conv2d, BuildConv2dNode); diff --git a/python/paddle/fluid/tests/unittests/ngraph/test_conv2d_ngraph_op.py b/python/paddle/fluid/tests/unittests/ngraph/test_conv2d_ngraph_op.py index ff2e865b66a..764d136ec8d 100644 --- a/python/paddle/fluid/tests/unittests/ngraph/test_conv2d_ngraph_op.py +++ b/python/paddle/fluid/tests/unittests/ngraph/test_conv2d_ngraph_op.py @@ -15,7 +15,40 @@ from __future__ import print_function import unittest -from paddle.fluid.tests.unittests.test_conv2d_op import TestConv2dOp, TestWithPad, TestWithStride, TestWithGroup, TestWith1x1, TestWithInput1x1Filter1x1 +from paddle.fluid.tests.unittests.test_conv2d_op import TestConv2dOp, TestWithPad, TestWithStride, TestWithGroup, TestWith1x1, TestWithInput1x1Filter1x1, TestDepthwiseConv, TestDepthwiseConv2, TestDepthwiseConv3, TestDepthwiseConvWithDilation, TestDepthwiseConvWithDilation2 + + +class TestNGRAPHDepthwiseConv(TestDepthwiseConv): + def init_test_case(self): + super(TestNGRAPHDepthwiseConv, self).init_test_case() + self.use_cuda = False + + +class TestNGRAPHDepthwiseConv2(TestDepthwiseConv2): + def init_test_case(self): + super(TestNGRAPHDepthwiseConv2, self).init_test_case() + self.use_cuda = False + + +class TestNGRAPHDepthwiseConv3(TestDepthwiseConv3): + def init_test_case(self): + super(TestNGRAPHDepthwiseConv3, self).init_test_case() + self.use_cuda = False + + +class TestNGRAPHDepthwiseConvWithDilation(TestDepthwiseConvWithDilation): + def init_test_case(self): + super(TestNGRAPHDepthwiseConvWithDilation, self).init_test_case() + self.use_cuda = False + + +class TestNGRAPHDepthwiseConvWithDilation2(TestDepthwiseConvWithDilation2): + def init_test_case(self): + super(TestNGRAPHDepthwiseConvWithDilation2, self).init_test_case() + self.use_cuda = False + + +del TestDepthwiseConv, TestDepthwiseConv2, TestDepthwiseConv3, TestDepthwiseConvWithDilation, TestDepthwiseConvWithDilation2 if __name__ == '__main__': unittest.main() -- GitLab