How to disable beta in BatchNorm2d

Set affine=False disables gamma and beta, is there a way to only disable beta?

In Chainer, you can set:
L.BatchNormalization(128, use_beta=False),

and in Tensorflow, you can set
tf.layers.batch_normalization(..., center=False).

You could use the functional interface, which lets you specify gamma and beta directly, or you could just delete the beta parameter from a batchnorm2d module and replace it with "my_batchnorm_module.register_parameter(‘bias’,None). Or you could subclass batchnorm2d and just change either the constructor or the forward method.

Yeah, basically I need to ‘recreate’ a new BN module, or go through all the BN layers to set bias=None after creating the network, which is not very elegant.

I wonder is there any plan of adding this switch directly into BN params? @Soumith_Chintala @apaszke

we only allow disabling both gamma and beta together via affine=False: http://pytorch.org/docs/nn.html#batchnorm2d

Hi,
Could you tell me how to recreate a new BN2d module?? Cause I am having the same problem.

Thank you so much.