Hi @ShoufaChen, your problem is easy as for this there exist "special"
dimensions numbers, see
[nd.array.reshape](https://mxnet.incubator.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.NDArray.reshape)
operation. The same exists for Symbol
```Python
class CustomNet(HybridBlock):
def __init__(self,**kwards):
HybridBlock.__init__(self,**kwards)
with self.name_scope():
# do something here
def hybrid_forward(self,F,input):
# reshape input with product of two last dimensions
b = F.reshape(input,shape=[0,0,-3])
# now b has dimensions input.shape[0],input.shape[0],input.shape[2] *
input.shape[3]
return b
```
you can use this trick inside your custom layer definition. Hope this helps.
**edit**: an ipython example
```Python
In [1]: import mxnet as mx
In [2]: from mxnet import nd
In [3]: a = nd.random.uniform(shape=[5,3,12,12])
In [4]: b= nd.reshape(a,shape=(0,0,-3))
In [5]: b.shape
Out[5]: (5, 3, 144)
```
[ Full content available at:
https://github.com/apache/incubator-mxnet/issues/9288 ]
This message was relayed via gitbox.apache.org for [email protected]