code: def make_mlp_subclass_model(hparams):
      """Creates a multi-layer perceptron subclass model in Keras."""
  
      class MLP(tf.keras.Model):
          """Subclass model defining a multi-layer perceptron."""
  
          def __init__(self):
              super(MLP, self).__init__()
              self.cast_to_float_layer = tf.keras.layers.Lambda(
                  lambda x: tf.keras.backend.cast(x, tf.float32)
              )
              self.dense_layers = [
                  tf.keras.layers.Dense(num_units, activation="relu")
                  for num_units in hparams.num_fc_units
              ]
              self.dropout_layer = tf.keras.layers.Dropout(
                  hparams.dropout_rate
              )
              self.output_layer = tf.keras.layers.Dense(
                  hparams.num_classes, activation="softmax"
              )
  
          def call(self, inputs, training=False):
              cur_layer = self.cast_to_float_layer(inputs["words"])
              for dense_layer in self.dense_layers:
                  cur_layer = dense_layer(cur_layer)
                  cur_layer = self.dropout_layer(
                      cur_layer, training=training
                  )
  
              outputs = self.output_layer(cur_layer)
  
              return outputs
  
      return MLP()
  
file_path: neural-structured-learning/neural_structured_learning/examples/graph_keras_mlp_cora.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl import app
  from absl import flags
  from absl import logging
  import attr
  import neural_structured_learning
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: make_mlp_subclass_model(hparams) and returns: MLP, outputs