code: def test_normalization():
      inputs = tf.keras.layers.Input(shape=[2, 2, 1])
  
      base_layer = tf.keras.layers.Conv2D(
          1, (2, 2), kernel_initializer=tf.constant_initializer(value=2)
      )
      sn_layer = spectral_normalization.SpectralNormalization(
          base_layer
      )
      model = tf.keras.models.Sequential(layers=[inputs, sn_layer])
  
      weights = np.squeeze(model.layers[0].w.numpy())
      # This wrapper normalizes weights by the maximum eigen value
      eigen_val, _ = np.linalg.eig(weights)
      weights_normalized = weights / np.max(eigen_val)
  
      for training in [False, True]:
          _ = model(
              tf.constant(np.ones((1, 2, 2, 1), dtype=np.float32)),
              training=training,
          )
          if training:
              w = weights_normalized
          else:
              w = weights
          np.testing.assert_allclose(
              w, np.squeeze(model.layers[0].w.numpy())
          )
  
file_path: addons/tensorflow_addons/layers/tests/spectral_normalization_test.py
imports: import numpy
  import pytest
  import tensorflow
  from tensorflow_addons.layers import spectral_normalization
  from tensorflow_addons.utils import test_utils
label_desc: Use image node_id 6 for calling a global function with example usage: test_normalization() without return types