docstr: Test a simple training loop.
docstr_tok: ["Test","a","simple","training","loop","."]
code: def test_dynamic_graph_convolution_keras_layer_training(
      self, reduction
  ):
      """Test a simple training loop."""
      if not tf.executing_eagerly():
          return
      # Generate a small valid input for a simple training task.
      # Four corners of a square.
      data = np.array(
          ((1.0, 1.0), (-1.0, 1.0), (-1.0, -1.0), (1.0, -1.0))
      )
      neighbors_indices = np.array(
          (
              (0, 0),
              (0, 1),
              (0, 3),
              (1, 0),
              (1, 1),
              (1, 2),
              (2, 1),
              (2, 2),
              (2, 3),
              (3, 0),
              (3, 2),
              (3, 3),
          )
      )
      neighbors = tf.SparseTensor(
          neighbors_indices,
          np.ones(shape=(12,)) / 3.0,
          dense_shape=(4, 4),
      )
      # Desired output is arbitrary.
      labels = np.reshape([-1.0, -0.5, 0.5, 1.0], (-1, 1))
      num_training_iterations = 5
  
      with tf.GradientTape(persistent=True) as tape:
          layer = gc_layer.DynamicGraphConvolutionKerasLayer(
              num_output_channels=2, reduction=reduction
          )
          output = layer(inputs=[data, neighbors], sizes=None)
          loss = tf.nn.l2_loss(output - labels)
  
          trainable_variables = layer.trainable_variables
          for _ in range(num_training_iterations):
              grads = tape.gradient(loss, trainable_variables)
              tf.compat.v1.train.GradientDescentOptimizer(
                  1e-4
              ).apply_gradients(list(zip(grads, trainable_variables)))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  from six.moves import range
  from six.moves import zip
  import tensorflow
  import tensorflow_graphics.nn.layer.graph_convolution
  from tensorflow_graphics.util import test_case
label_desc: Use image node_id 4 for calling the GraphConvolutionTestDynamicGraphConvolutionKerasLayerTests obj's underlying member method code with example usage: obj.test_dynamic_graph_convolution_keras_layer_training(reduction) without return types