docstr: Check subclass layer that is supported for m by n sparsity.
docstr_tok: ["Check","subclass","layer","that","is","supported","for","m","by","n","sparsity","."]
code: def testSparsityPruningMbyN_SupportedSubclassLayers(self):
      """Check subclass layer that is supported for m by n sparsity."""
      m_by_n = (2, 4)
      self.params.update({"sparsity_m_by_n": m_by_n})
  
      class SubclassLayer(tf.keras.layers.Layer):
          def __init__(self):
              super(SubclassLayer, self).__init__()
              self.conv1 = tf.keras.layers.Conv2D(
                  2,
                  3,
                  activation="relu",
                  padding="same",
                  input_shape=[7, 7, 3],
              )
              self.conv2 = tf.keras.layers.DepthwiseConv2D(3)
              self.flatten = keras.layers.Flatten()
              self.dense = layers.Dense(10, activation="sigmoid")
  
          def call(self, inputs):
              x = self.conv1(inputs)
              x = self.conv2(x)
              x = self.flatten(x)
              x = self.dense(x)
              return x
  
      inputs = keras.Input(shape=(7, 7, 3))
      outputs = SubclassLayer()(inputs)
      model = keras.Model(inputs, outputs)
      with self.assertRaises(ValueError):
          model = prune.prune_low_magnitude(model, **self.params)
  
      model.compile(
          loss="categorical_crossentropy",
          optimizer="sgd",
          metrics=["accuracy"],
      )
  
      test_utils.assert_model_sparsity(self, 0.0, model)
      model.fit(
          np.random.randn(
              *self._batch(model.input.get_shape().as_list(), 32)
          ),
          np.random.randn(
              *self._batch(model.output.get_shape().as_list(), 32)
          ),
          callbacks=[pruning_callbacks.UpdatePruningStep()],
      )
  
      test_utils.assert_model_sparsity_m_by_n(self, model, m_by_n)
      self._check_strip_pruning_matches_original(model, 0.5)
  
imports: import tempfile
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import test_utils
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import prune_registry
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_callbacks
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_schedule
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
  from tensorflow_model_optimization.python.core.sparsity.keras import test_utils
label_desc: Use image node_id 19 for calling the PruneIntegrationTest obj's underlying member method code with example usage: obj.testSparsityPruningMbyN_SupportedSubclassLayers() and returns: x