Incubator-mxnet: [Feature Request] consistent behavior of reshape() in ndarray and symbol mode

Created on 11 Sep 2019  路  2Comments  路  Source: apache/incubator-mxnet

For reshape() operator, I found that it works with input which is not a tuple. For example:

x = mx.nd.array([1,2,3,4])

y = x.reshape(2,2)   # input is not a tuple
# y = [[1. 2.]
#     [3. 4.]]

y = x.reshape((2,2))    
# y = [[1. 2.]
#     [3. 4.]]

However, the bebavior is not consistent in symbol mode for reshape() with non-tuple input. It will raise an error.

It is bothering that when implementing hybrid_forward() in HybridBlock, codes( F.reshape() ) in two modes are the same. We usually disable hybridized mode for debugging (printing shape, context), and then enable it for efficiency. Since error messages in hybridized mode are a little vague, this inconsistent behavior of reshape() makes users hard to realize the reason of the error, and also hard to debug.

Backend Bug v1.x

Most helpful comment

Hi @chongruo, I'm preparing a RFC to unify symbolic and imperative interfaces and handle the difference in the backend automatically. I'll comment here once the RFC is published. It would resolve this feature request.

All 2 comments

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended label(s): Feature

Hi @chongruo, I'm preparing a RFC to unify symbolic and imperative interfaces and handle the difference in the backend automatically. I'll comment here once the RFC is published. It would resolve this feature request.

Was this page helpful?
0 / 5 - 0 ratings