"Mirror" autoencoder - how-to share parameters between layers?

Hello,

I am trying to build a “mirror” autoencoder where the encoder parameters would be the same as decoder parameters.

In the simplest case, autoencoder:

• conv
• fc_1
• fc_2
• convT

How can I denote parameters of fc_1 to be the same (mirrored) as parameters of fc_2?
Similarly, how can I share parameters between the 1st convolution and last deconvolution layers?

Thank you for the consideration!

I think the easiest way would be to define the parameters manually and use the functional API for all operations, e.g.:

out = F.conv2d(intput, weight)

where you’ve defined the weight as a parameter before.

1 Like

Thank you, sounds like what is needed!

1 Like