code: def test_custom_layer(self):
      layer = CustomLayer(factor=2)
      x = ops.random.normal((2, 2))
      y1 = layer(x)
      _, new_layer, _ = self.roundtrip(
          layer, custom_objects={"CustomLayer": CustomLayer}
      )
      y2 = new_layer(x)
      self.assertAllClose(y1, y2, atol=1e-5)
  
      layer = NestedCustomLayer(factor=2)
      x = ops.random.normal((2, 2))
      y1 = layer(x)
      _, new_layer, _ = self.roundtrip(
          layer,
          custom_objects={
              "NestedCustomLayer": NestedCustomLayer,
              "custom_fn": custom_fn,
          },
      )
      _ = new_layer(x)
      new_layer.set_weights(layer.get_weights())
      y2 = new_layer(x)
      self.assertAllClose(y1, y2, atol=1e-5)
  
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 6 for calling the SerializationLibTest obj's underlying member method code with example usage: obj.test_custom_layer() without return types