code: def test_trainable_behavior(self):
      layer = layers.BatchNormalization(
          axis=-1, momentum=0.8, epsilon=1e-7
      )
      layer.build((1, 4, 4, 3))
      layer.trainable = False
      self.assertEqual(len(layer.weights), 4)
      self.assertEqual(len(layer.trainable_weights), 0)
      self.assertEqual(len(layer.non_trainable_weights), 4)
  
      # Random data centered on 5.0, variance 10.0
      x = np.random.normal(loc=5.0, scale=10.0, size=(200, 4, 4, 3))
  
      out = layer(x, training=True)
      self.assertAllClose(out, x)
  
      layer.trainable = True
      self.assertEqual(len(layer.weights), 4)
      self.assertEqual(len(layer.trainable_weights), 2)
      self.assertEqual(len(layer.non_trainable_weights), 2)
  
      for _ in range(10):
          out = layer(x, training=True)
  
      out = backend.convert_to_numpy(out)
      out -= np.reshape(
          backend.convert_to_numpy(layer.beta), (1, 1, 1, 3)
      )
      out /= np.reshape(
          backend.convert_to_numpy(layer.gamma), (1, 1, 1, 3)
      )
  
      self.assertAllClose(np.mean(out, axis=(0, 1, 2)), 0.0, atol=1e-3)
      self.assertAllClose(np.std(out, axis=(0, 1, 2)), 1.0, atol=1e-3)
  
file_path: keras/keras/layers/normalization/batch_normalization_test.py
imports: import numpy
  import pytest
  from absl.testing import parameterized
  from keras import backend
  from keras import layers
  from keras import testing
  from keras.losses import MeanSquaredError
  from keras.models import Model
label_desc: Use image node_id 5 for calling the BatchNormalizationTest obj's underlying member method code with example usage: obj.test_trainable_behavior() without return types