code: def test_gradient_penalty_loss_jacobian_preset(self):
      layer_weights = np.zeros(shape=(25, 1), dtype=np.float32)
      real_data = np.ones(shape=(1, 5, 5), dtype=np.float32)
      generated_data = np.ones(shape=(1, 5, 5), dtype=np.float32)
  
      def gradient_penalty_fn(weights):
          def multiply(input_tensor):
              return tf.linalg.matmul(input_tensor, weights)
  
          discriminator = tf.keras.Sequential()
          discriminator.add(tf.keras.layers.Reshape((25,)))
          # To simulate a dense layer a lambda layer is used, such that we are able
          # to feed the weights in as numpy array to the assert_jacobian_fn.
          discriminator.add(tf.keras.layers.Lambda(multiply))
  
          return losses.gradient_penalty_loss(
              real_data=tf.convert_to_tensor(real_data),
              generated_data=tf.convert_to_tensor(generated_data),
              discriminator=discriminator,
          )
  
      with self.subTest(name="is_correct"):
          self.assert_jacobian_is_correct_fn(
              gradient_penalty_fn, (layer_weights,)
          )
      with self.subTest(name="is_finite"):
          self.assert_jacobian_is_finite_fn(
              gradient_penalty_fn, (layer_weights,)
          )
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_graphics.projects.gan import losses
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 5 for calling the LossesTest obj's underlying member method code with example usage: obj.test_gradient_penalty_loss_jacobian_preset() and returns: losses, tf