From d00a19a53d823fe0b43a1c3d5a7cae80b3d746fc Mon Sep 17 00:00:00 2001 From: reminisce Date: Thu, 30 Jan 2020 14:00:13 -0800 Subject: [PATCH 1/2] Remove conv3d dilation restriction --- src/operator/nn/convolution.cc | 2 -- tests/python/unittest/test_operator.py | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/operator/nn/convolution.cc b/src/operator/nn/convolution.cc index a07c1ad78a97..0fa505f56d40 100644 --- a/src/operator/nn/convolution.cc +++ b/src/operator/nn/convolution.cc @@ -239,8 +239,6 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs, << "incorrect stride size: " << param_.stride; CHECK_GT(param_.dilate.Size(), 0U) \ << "incorrect dilate size: " << param_.dilate; - CHECK_EQ(param_.dilate.Size(), 1U) - << "Dilate is not supported in 3d convolution"; Shape<5> oshape; oshape[0] = dshape[0]; oshape[1] = param_.num_filter; diff --git a/tests/python/unittest/test_operator.py b/tests/python/unittest/test_operator.py index 93ecd8bd4c23..906efac4ddfe 100644 --- a/tests/python/unittest/test_operator.py +++ b/tests/python/unittest/test_operator.py @@ -2600,6 +2600,10 @@ def test_convolution_dilated_impulse_response(): for dil in [ (1,1), (2,2), (3,3) ]: for ks in [ (3,3), (4,4), (2,3), (3,2), (1,1) ]: test_run_convolution_dilated_impulse_response(dil=dil, kernel_shape=ks) + # 3D + for dil in [ (1,1,1), (2,2,2), (3,3,3) ]: + for ks in [ (3,3,3), (4,4,4), (2,3,4), (3,2,4), (1,1,1) ]: + test_run_convolution_dilated_impulse_response(dil=dil, kernel_shape=ks) @with_seed() From a014ab2c2d006174e05d694fd82b531f2c190f35 Mon Sep 17 00:00:00 2001 From: reminisce Date: Thu, 30 Jan 2020 14:00:35 -0800 Subject: [PATCH 2/2] Remove comment --- src/operator/nn/convolution.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/operator/nn/convolution.cc b/src/operator/nn/convolution.cc index 0fa505f56d40..8ff5ea75d5f7 100644 --- a/src/operator/nn/convolution.cc +++ b/src/operator/nn/convolution.cc @@ -223,8 +223,6 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs, SHAPE_ASSIGN_CHECK(*in_shape, conv::kBias, Shape1(param_.num_filter)); } - // Note: 3D dilation currently not supported. - // Calculations below done to preserve symmetry with 1D/2D code. const index_t dilated_ksize_d = param_.DilatedKernelSize(0); const index_t dilated_ksize_y = param_.DilatedKernelSize(1); const index_t dilated_ksize_x = param_.DilatedKernelSize(2);