You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2022/02/03 19:07:05 UTC

[GitHub] [incubator-mxnet] mazeltovlee opened a new issue #20870: MXNet sym.Convolution can run even when the declared shape of variable is incorrect

mazeltovlee opened a new issue #20870:
URL: https://github.com/apache/incubator-mxnet/issues/20870


   ## Description
   `mx.sym.Convolution` can still work even when the shape of `mx.sym.Variable` is incorrect.
   
   
   ## To Reproduce
   
   
   ### Steps to reproduce
   ```
   import mxnet as mx
   net = mx.symbol.Variable('data')
   net = mx.sym.reshape(data=net, shape=(0, 10, 10, 3))
   net = mx.sym.transpose(data=net, axes=[0,3,1,2])
   
   weight = mx.symbol.Variable("conv2d_1/kernel1", shape=(3, 1e+10, 3, 3), stype="default", dtype=np.float32)
   weight = mx.symbol.transpose(data=weight, axes=[0,1,2,3])
   bias = mx.symbol.Variable("conv2d_1/bias1", shape=(3,))
   net = mx.symbol.Convolution(data=net, name="conv2d_1/conv2d3",
                                 kernel=(3, 3), stride=(1, 1), pad=(),
                                 num_filter=3, weight=weight,
                                 dilate=(1,1), bias=bias)
   import numpy as np
   input_shape = (10, 10, 10, 3)
   x = np.random.rand(*input_shape)
   e = net.bind(mx.cpu(), {'data': mx.nd.array(x), "conv2d_1/kernel1": mx.nd.array(np.random.rand(3,3,3,3)), "conv2d_1/bias1": mx.nd.array(np.random.rand(3,))})
   e.forward()
   ```
   When running the above code, the symbolic model `e` can still output a reasonable result even though I have declared the shape of the weight variable to be **an unreasonable value: shape=(3, 1e+10, 3, 3)**. It seems that mxnet will not refer to the declared shape in `mx.Variable`, but intuitively speaking, setting the unreasonable variable shape while model can still run may be misleading. 
   
   I am wondering if you can add some shape checks between the declared variable shape and the actual bound data shape.


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] github-actions[bot] commented on issue #20870: MXNet sym.Convolution can run even when the declared shape of variable is incorrect

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #20870:
URL: https://github.com/apache/incubator-mxnet/issues/20870#issuecomment-1029309475


   Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue.
   Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly.
   If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on [contributing to MXNet](https://mxnet.apache.org/community/contribute) and our [development guides wiki](https://cwiki.apache.org/confluence/display/MXNET/Developments).


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org