> `infer_shape` might have been a misnomer because what it does is actually 
> inferring the shapes of parameters, and what you expect as well as the 
> `infer_shape` that symbol provides is for inferring output shape.
> 
> In general, in HybridBlock you shouldn't depend on the exact shape of input, 
> because otherwise it indicates that the computation graph may change 
> depending on the shape, thus rendering it unsuitable for HybridBlock. That 
> said, there are plenty of ways to get around the dependency on the exact 
> value of shape (e.g. [special placeholders in 
> reshape](https://mxnet.incubator.apache.org/versions/master/api/python/symbol/symbol.html?highlight=reshape#mxnet.symbol.reshape),
>  `XX_like` operators such as 
> [zeros_like](https://mxnet.incubator.apache.org/versions/master/api/python/symbol/symbol.html?highlight=reshape#mxnet.symbol.zeros_like)).
> 
> If you could share exactly how you depend on the shape, others and I might be 
> able to help more.

I depend on the shape as : 


I have a `y` : `(batch , c, h*w)`,  and `x`: `(batch, c, h, w)` 

`h` and `w` is not determined.  Before I use `net.hybridize()`, I can use 
`y.reshape(0, 0, *x.shape[2:])`, however, after the `hybridize`, the `symbol` 
don't have the `shape` attribute, so how to achieve the same purpose?

how could I do?  thank you very much.

[ Full content available at: 
https://github.com/apache/incubator-mxnet/issues/9288 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to