If you don’t want to train the affine parameters at all (weight and bias), you could just initialize the batch norm layer with affine=False.
Otherwise to disable their updates temporarily, you could set the .requires_grad attribute to False as shown in your example.