piiswrong commented on issue #8943: how to share parameters while my network is 
a bit fancy?
URL: 
https://github.com/apache/incubator-mxnet/issues/8943#issuecomment-349412104
 
 
   To shared parameters, change mynn to
   
   ```
   self.net1 = Net()
   self.net2 = Net(params=self.net1.collect_params())
   ```
   
   But you actually don't need net1 and net2, you can just do
   ```
       def forward(self, x1 , x2):
           x = self.net(x1) - self.net(x2)
           x = self.net3(x)
           return x
   ```

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