code: def testTrainableVariableInitializationInModelFit(self, model_type):
      if tf.__internal__.tf2.enabled() and tf.executing_eagerly():
          sgd = tf_keras.optimizers.SGD(learning_rate=0.0)
      else:
          sgd = tf_keras.optimizers.legacy.SGD(learning_rate=0.0)
      model = self._define_model(
          model_type, self.data_dim, self.num_hidden
      )
      model.compile(optimizer=sgd, loss="mse")
      model.fit(
          x=self.random_input,
          y=self.random_targets,
          batch_size=4,
          shuffle=False,
          epochs=1,
      )
  
      norm_layer = self._get_maybe_norm_layer(model)
      self.assertLen(norm_layer.trainable_variables, 3)
      self.assertTrue(self.evaluate(norm_layer.initialized))
  
      # Verify initialization is correct
      (
          true_init_g,
          true_init_bias,
      ) = self._calculate_true_initial_variables_dense(
          self.random_input[:4], self.data_dim, self.num_hidden
      )
      self.assertAllClose(true_init_g, self.evaluate(norm_layer.g))
      self.assertAllClose(
          true_init_bias, self.evaluate(norm_layer.layer.bias)
      )
  
      # Ensure model isn't re-initialized when called on new data
      new_input = np.random.rand(self.batch_size, self.data_dim)
      model.fit(
          x=new_input,
          y=self.random_targets,
          batch_size=4,
          shuffle=False,
          epochs=1,
      )
  
      self.assertAllClose(true_init_g, self.evaluate(norm_layer.g))
      self.assertAllClose(
          true_init_bias, self.evaluate(norm_layer.layer.bias)
      )
  
      model(new_input)
      self.assertAllClose(true_init_g, self.evaluate(norm_layer.g))
      self.assertAllClose(
          true_init_bias, self.evaluate(norm_layer.layer.bias)
      )
  
      # Ensure variables are updated when learning rate is nonzero
      model.compile(optimizer="sgd", loss="mse")
      model.fit(
          x=self.random_input,
          y=self.random_targets,
          batch_size=4,
          shuffle=False,
          epochs=1,
      )
  
      norm_layer = self._get_maybe_norm_layer(model)
      self.assertNotAllClose(true_init_g, self.evaluate(norm_layer.g))
      self.assertNotAllClose(
          true_init_bias, self.evaluate(norm_layer.layer.bias)
      )
  
imports: import tempfile
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.layers import weight_norm
label_desc: Use image node_id 11 for calling the WeightNormTest obj's underlying member method code with example usage: obj.testTrainableVariableInitializationInModelFit(model_type) without return types