How to share a single parameter across two gluon layers?

#1

I want to use two gluon.nn.BatchNorm layers with shared gamma parameter. I know how to make the two layers share all the parameters but I do not know how to share a single parameter. Following is the code to share all the parameters.

BN1 = gluon.nn.BatchNorm()
BN2 = gluon.nn.BatchNorm(params=BN1.params)

Any help would be highly appreciated. I want these two layers to share only “gamma” parameter instead of all the parameters.