You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/04/17 10:34:33 UTC

[GitHub] [incubator-mxnet] Adnios opened a new pull request #20186: [BUGFIX] Add check for group not equal zero

Adnios opened a new pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186


   ## Description ##
   Related issue: #19921
   
   When `group=0`, the `mxnet.gluon.nn.Conv1D(Conv2D, Conv3D)` will cause crashes(floating point exception)
   
   ```
   11396 Floating point exception(core dumped) python test-mxnet.py
   ```
   MxNet doesn't seem to have checked whether `group=0`. This pr adds check for group not equal zero in `src/operator/nn/convolution.cc`. Now the error message will be like this.
   
   ```
   Traceback (most recent call last):
     File "test-mxnet.py", line 14, in <module>
       nn.Conv3D(channels=1, kernel_size=1, groups=0)
     File "/mxnet/python/mxnet/gluon/nn/conv_layers.py", line 401, in __init__
       in_channels, activation, use_bias, weight_initializer, bias_initializer, **kwargs)
     File "/mxnet/python/mxnet/gluon/nn/conv_layers.py", line 115, in __init__
       wshapes = _infer_weight_shape(op_name, dshape, self._kwargs)
     File "/mxnet/python/mxnet/gluon/nn/conv_layers.py", line 38, in _infer_weight_shape
       return sym.infer_shape_partial()[0]
     File "/mxnetpython/mxnet/symbol/symbol.py", line 1068, in infer_shape_partial
       return self._infer_shape_impl(True, *args, **kwargs)
     File "/mxnet/python/mxnet/symbol/symbol.py", line 1126, in _infer_shape_impl
       ctypes.byref(complete)))
     File "/PARA/blsc365/wangjian/mxnet-1.4.1-sleep/python/mxnet/base.py", line 252, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: Error in operator conv1_convolution0: [17:48:51] src/operator/nn/convolution.cc:215: Check failed: param_.num_group != 0U (0 vs. 0) num_group must be nonzero
   ```
   
   We can use the following code to test.
   
   ```
   import mxnet
   mxnet.gluon.nn.Conv1D(channels=1, kernel_size=1, groups=0)
   ```
   ```
   import mxnet
   mxnet.gluon.nn.Conv2D(channels=1, kernel_size=1, groups=0)
   ```
   ```
   import mxnet
   mxnet.gluon.nn.Conv3D(channels=1, kernel_size=1, groups=0)
   ```
   
   
   ## Checklist ##
   ### Essentials ###
   - [x] PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage
   - [x] Code is well-documented
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be made.
   - Interesting edge cases to note here
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821941614


   @mxnet-bot run ci [unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821807764


   @mxnet-bot run ci [all]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821961359


   @mxnet-bot run ci [all]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on a change in pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on a change in pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#discussion_r615491634



##########
File path: src/operator/nn/convolution.cc
##########
@@ -99,6 +99,8 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs,
     // 1d conv
     CHECK_EQ(dshp.ndim(), 3U) << "Input data should be 3D in batch-num_filter-x";
     Shape<3> dshape = ConvertLayout(dshp.get<3>(), param_.layout.value(), kNCW);
+    CHECK_NE(param_.num_group, 0U) \
+      << "num_group must be non-zero";

Review comment:
       Thanks for your advice. We can use the following coding.
   ```
       CHECK_GT(param_.num_group, 0U) \
         << "Range only supports num_group > 0, received "<<param_.num_group;
   ```
   Should I change the code and commit it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios edited a comment on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
Adnios edited a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821829690


   @mxnet-bot run ci [unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821941491


   @mxnet-label-bot pr-awaiting-review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha merged pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
szha merged pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on a change in pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
szha commented on a change in pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#discussion_r615492725



##########
File path: src/operator/nn/convolution.cc
##########
@@ -99,6 +99,8 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs,
     // 1d conv
     CHECK_EQ(dshp.ndim(), 3U) << "Input data should be 3D in batch-num_filter-x";
     Shape<3> dshape = ConvertLayout(dshp.get<3>(), param_.layout.value(), kNCW);
+    CHECK_NE(param_.num_group, 0U) \
+      << "num_group must be non-zero";

Review comment:
       Yes looks good. Thanks




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821941614


   @mxnet-bot run ci [unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821802736


   Hey @Adnios , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [clang, edge, unix-gpu, website, centos-gpu, centos-cpu, windows-gpu, unix-cpu, windows-cpu, miscellaneous, sanity]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821807764


   @mxnet-bot run ci [all]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on a change in pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
szha commented on a change in pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#discussion_r615485488



##########
File path: src/operator/nn/convolution.cc
##########
@@ -99,6 +99,8 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs,
     // 1d conv
     CHECK_EQ(dshp.ndim(), 3U) << "Input data should be 3D in batch-num_filter-x";
     Shape<3> dshape = ConvertLayout(dshp.get<3>(), param_.layout.value(), kNCW);
+    CHECK_NE(param_.num_group, 0U) \
+      << "num_group must be non-zero";

Review comment:
       - the `num_group` argument can't be negative either so it would be better to check for `CHECK_GT(..., 0)`
   - It would be better to report the received number.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on a change in pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on a change in pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#discussion_r615491634



##########
File path: src/operator/nn/convolution.cc
##########
@@ -99,6 +99,8 @@ static bool ConvolutionShape(const nnvm::NodeAttrs& attrs,
     // 1d conv
     CHECK_EQ(dshp.ndim(), 3U) << "Input data should be 3D in batch-num_filter-x";
     Shape<3> dshape = ConvertLayout(dshp.get<3>(), param_.layout.value(), kNCW);
+    CHECK_NE(param_.num_group, 0U) \
+      << "num_group must be non-zero";

Review comment:
       Thanks for your advice. We can use the following coding.
   ```
       CHECK_GT(param_.num_group, 0U) \
         << "Range only supports num_group > 0, received "<<param_.num_group;
   ```
   Should I change the coding and commit it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-822224332


   @mxnet-bot run ci [windows-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821998266


   @mxnet-bot run ci [windows-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-822224332


   @mxnet-bot run ci [windows-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821829690


   @mxnet-bot run ci [all]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821941491


   @mxnet-label-bot pr-awaiting-review


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
Adnios commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-822224630


   @mxnet-bot run ci [windows-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
szha commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-822097569


   @mxnet-bot run ci [windows-cpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Adnios removed a comment on pull request #20186: [BUGFIX] Add check for group not equal zero

Posted by GitBox <gi...@apache.org>.
Adnios removed a comment on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-821829690


   @mxnet-bot run ci [unix-gpu]


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] szha commented on pull request #20186: [BUGFIX] Add check to make sure num_group is non-zero

Posted by GitBox <gi...@apache.org>.
szha commented on pull request #20186:
URL: https://github.com/apache/incubator-mxnet/pull/20186#issuecomment-822746714


   @Adnios thank you for the fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org