code: def testPruneSequentialModelForLatencyOnXNNPackPolicy(self):
      # No InputLayer
      model = keras.Sequential(
          [
              layers.ZeroPadding2D(padding=1),
              layers.Conv2D(
                  filters=4,
                  kernel_size=(3, 3),
                  strides=(2, 2),
                  padding="valid",
              ),
              layers.DepthwiseConv2D(
                  kernel_size=(3, 3), padding="same"
              ),
              layers.Conv2D(filters=8, kernel_size=[1, 1]),
              layers.GlobalAveragePooling2D(),
          ]
      )
      with self.assertRaises(ValueError) as e:
          _ = prune.prune_low_magnitude(
              model,
              pruning_policy=pruning_policy.PruneForLatencyOnXNNPack(),
              **self.params,
          )
      self.assertEqual(
          str(e.exception), self.INVALID_TO_PRUNE_UNBUILT_ERROR
      )
  
      # With InputLayer
      model = keras.Sequential(
          [
              layers.ZeroPadding2D(padding=1, input_shape=(8, 8, 3)),
              layers.Conv2D(
                  filters=4,
                  kernel_size=(3, 3),
                  strides=(2, 2),
                  padding="valid",
              ),
              layers.DepthwiseConv2D(
                  kernel_size=(3, 3), padding="same"
              ),
              layers.Conv2D(filters=8, kernel_size=[1, 1]),
              layers.GlobalAveragePooling2D(),
          ]
      )
      pruned_model = prune.prune_low_magnitude(
          model,
          pruning_policy=pruning_policy.PruneForLatencyOnXNNPack(),
          **self.params,
      )
      self.assertEqual(self._count_pruned_layers(pruned_model), 1)
  
imports: import distutils.version
  import tensorflow
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_policy
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_schedule
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
label_desc: Use image node_id 6 for calling the PruningPolicyTest obj's underlying member method code with example usage: obj.testPruneSequentialModelForLatencyOnXNNPackPolicy() without return types