[GitHub] piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization
piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization URL: https://github.com/apache/incubator-mxnet/pull/7393#discussion_r132803681 ## File path: src/operator/convolution-inl.h ## @@ -97,6 +98,8 @@ struct ConvolutionParam : public dmlc::Parameter { .set_default(dmlc::optional()) .describe("Set layout for input, output and weight. Empty for\n" "default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d."); +DMLC_DECLARE_FIELD(depthwise_conv_off).set_default(false) +.describe("whether to turn off depthwise convolution for this layer"); Review comment: Let's remove this if there are no important reasons. Convolution has too many switches. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization
piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization URL: https://github.com/apache/incubator-mxnet/pull/7393#discussion_r132094838 ## File path: tests/python/unittest/test_operator.py ## @@ -955,6 +955,40 @@ def test_convolution_grouping(): for arr1, arr2 in zip(exe1.outputs + exe1.grad_arrays, exe2.outputs + exe2.grad_arrays): np.testing.assert_allclose(arr1.asnumpy(), arr2.asnumpy(), rtol=1e-3, atol=1e-4) +def test_depthwise_convolution(): +num_base = 32 +num_filter = num_base +num_group = num_base +kernel = (3, 3) +stride = (1, 1) +pad = (1,1) +shape = (2, num_base, 224, 224) + +x = mx.sym.Variable('x') +w = mx.sym.Variable('w') +b = mx.sym.Variable('b') +y1 = mx.sym.Convolution(data=x, weight=w, bias=b, num_filter=num_filter, num_group=num_group, kernel=kernel, stride=stride, pad=pad) +xslice = mx.sym.SliceChannel(data=x, num_outputs=num_group, axis=1) +wslice = mx.sym.SliceChannel(data=w, num_outputs=num_group, axis=0) +bslice = mx.sym.SliceChannel(data=b, num_outputs=num_group, axis=0) +y2 = mx.sym.Concat(*[mx.sym.Convolution(data=xslice[i], weight=wslice[i], bias=bslice[i], +num_filter=num_filter/num_group, kernel=kernel, stride=stride, pad=pad) + for i in range(num_group)]) + +dev = mx.gpu(0) Review comment: dev = default_context(). This will fail on gpu-less test servers. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization
piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization URL: https://github.com/apache/incubator-mxnet/pull/7393#discussion_r132094170 ## File path: tests/python/unittest/test_operator.py ## @@ -955,6 +955,40 @@ def test_convolution_grouping(): for arr1, arr2 in zip(exe1.outputs + exe1.grad_arrays, exe2.outputs + exe2.grad_arrays): np.testing.assert_allclose(arr1.asnumpy(), arr2.asnumpy(), rtol=1e-3, atol=1e-4) +def test_depthwise_convolution(): Review comment: Please move tests to tests/python/gpu/test_operator_gpu.py and use the standard consistency and numerical gradient tests. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization
piiswrong commented on a change in pull request #7393: add depthwise convolution's gpu version optimization URL: https://github.com/apache/incubator-mxnet/pull/7393#discussion_r132093497 ## File path: src/operator/convolution-inl.h ## @@ -97,6 +98,8 @@ struct ConvolutionParam : public dmlc::Parameter { .set_default(dmlc::optional()) .describe("Set layout for input, output and weight. Empty for\n" "default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d."); +DMLC_DECLARE_FIELD(depthwise_conv_off).set_default(false) +.describe("whether to turn off depthwise convolution for this layer"); Review comment: any reason we would want to turn this off? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services