code: def test_functional_subclass(self):
      class PlainFunctionalSubclass(keras.Model):
          pass
  
      inputs = keras.Input((2,), batch_size=3)
      outputs = keras.layers.Dense(1)(inputs)
      model = PlainFunctionalSubclass(inputs, outputs)
      x = ops.random.normal((2, 2))
      y1 = model(x)
      _, new_model, _ = self.roundtrip(
          model,
          custom_objects={
              "PlainFunctionalSubclass": PlainFunctionalSubclass
          },
      )
      new_model.set_weights(model.get_weights())
      y2 = new_model(x)
      self.assertAllClose(y1, y2, atol=1e-5)
      self.assertIsInstance(new_model, PlainFunctionalSubclass)
  
      class FunctionalSubclassWCustomInit(keras.Model):
          def __init__(self, num_units=2):
              inputs = keras.Input((2,), batch_size=3)
              outputs = keras.layers.Dense(num_units)(inputs)
              super().__init__(inputs, outputs)
              self.num_units = num_units
  
          def get_config(self):
              return {"num_units": self.num_units}
  
      model = FunctionalSubclassWCustomInit(num_units=3)
      x = ops.random.normal((2, 2))
      y1 = model(x)
      _, new_model, _ = self.roundtrip(
          model,
          custom_objects={
              "FunctionalSubclassWCustomInit": FunctionalSubclassWCustomInit
          },
      )
      new_model.set_weights(model.get_weights())
      y2 = new_model(x)
      self.assertAllClose(y1, y2, atol=1e-5)
      self.assertIsInstance(new_model, FunctionalSubclassWCustomInit)
  
imports: import json
  import numpy
  import pytest
  import keras
  from keras import ops
  from keras import testing
  from keras.saving import serialization_lib
label_desc: Use image node_id 10 for calling the SerializationLibTest obj's underlying member method code with example usage: obj.test_functional_subclass() and returns: dict