szha commented on issue #7785: How can I build a conv block using other conv's 
weights.
URL: 
https://github.com/apache/incubator-mxnet/issues/7785#issuecomment-327677122
 
 
   By reuse, do you mean you would like to tie their weights? Here's an 
[example](https://github.com/apache/incubator-mxnet/blob/master/example/gluon/word_language_model/model.py#L48-L52)
 of how to tie the weights. The weights always remain the same.
   
   I'm not familiar with torch, and I'm assuming that the AddTable is a 
declarative way of writing addition. In Gluon, this should be written in 
`hybrid_forward`. In that method, `x` is your input data, and you can use the 
layers declared in the constructor such as `self.U` by calling them with the 
input data (i.e. `output = self.U(x)`), just like calling a function in python. 
Once you finish writing the calculation of `C[i]` and `U`, Addition is then the 
simple addition of `C_out + U_out`.
   
   A great place to start learning about gluon is the interactive book. 
http://gluon.mxnet.io/. The gluon related chapters might be of most interest to 
you.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to