# Copy and override nn.Module parameters with other nn.Module parameters

**URL:** <https://discuss.pytorch.org/t/copy-and-override-nn-module-parameters-with-other-nn-module-parameters/16800>\
**Category:** Uncategorized\
**Created:** [April 22, 2018, 3:21pm UTC](https://discuss.pytorch.org/t/copy-and-override-nn-module-parameters-with-other-nn-module-parameters/16800 "2018-04-22T15:21:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![omers66](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/o/53a042/32.png) [@omers66](https://discuss.pytorch.org/u/omers66)\
**Post date:** [April 22, 2018, 3:21pm UTC](https://discuss.pytorch.org/t/copy-and-override-nn-module-parameters-with-other-nn-module-parameters/16800/1 "2018-04-22T15:21:50Z")

</div>

Let’s say I have 2 instances of the same nn.Module architecture:  
actor1 = ActorNN()  
actor2 = ActorNN()

where ActorNN defined as:  
class ActorNN(nn.Module):

Now, let’s say that I want to replace all weights and biases of actor2 with the weights and biases of actor1.  
How can this be done easily?  
Thanks

---

<div class="post-metadata">

**Author:** ![albanD](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/alband/32/215_2.png) [@albanD](https://discuss.pytorch.org/u/albanD)\
**Post date:** [April 23, 2018, 9:19am UTC](https://discuss.pytorch.org/t/copy-and-override-nn-module-parameters-with-other-nn-module-parameters/16800/2 "2018-04-23T09:19:35Z")

</div>

Hi,

You can do `actor2.load_state_dict(actor1.state_dict())`.
