code: def test_pruning(
      ctx,
      func_name,
      seed,
      threshold,
      w_bias,
      channel_last,
      functions_to_pruning,
      graph,
  ):
      from .graph_converter_test_utils import (
          structure_tester,
          value_tester,
      )
  
      if channel_last == True and not func_name.endswith("Cudnn"):
          pytest.skip(
              "ChannelLast conversion is only supported in cuDNN context."
          )
      # The Deconv in Cuda is strange, it causes the test to fail.
      if func_name.endswith("Cuda"):
          pytest.skip("Skip test with Cuda context.")
      with nn.context_scope(ctx):
          # Random number
          np.random.seed(seed)
          rng = np.random.RandomState(seed)
  
          # Graph
          x_data = rng.randn(batch_size, 16, 16, 16)
          x1 = nn.Variable.from_numpy_array(x_data)
          x2 = nn.Variable.from_numpy_array(x_data)
  
          nn.random.seed(seed)
          y_tgt = graph(
              x1,
              threshold,
              with_bias=w_bias,
              channel_last=channel_last,
              name_scope="net1",
          )
  
          # Pruning with FunctionModifier
          modifiers = []
          modifiers.append(
              GC.PruningModifier(
                  threshold, functions_to_pruning, channel_last
              )
          )
  
          y_act = GC.GraphConverter(modifiers).convert(y_tgt)
  
          # Ref Graph
          nn.random.seed(seed)
          y_ref = graph(
              x2,
              threshold,
              with_bias=w_bias,
              channel_last=channel_last,
              name_scope="net2",
          )
          # Pruning manually
          pruning_inplace(
              y_ref, threshold, functions_to_pruning, channel_last
          )
  
          # Test
          structure_tester(y_ref, y_act)
  
          # Compare the results of manual pruning and pruning with GraphConverter
          # The results should be very close
          value_tester(y_ref, y_act, rtol=2e-6, atol=3e-8)
  
file_path: nnabla/python/test/utils/test_graph_converters/test_pruning.py
imports: from __future__ import absolute_import
  import pytest
  import numpy
  import nnabla
  import nnabla.experimental.graph_converters
  from nbla_test_utils import list_context
  from .ref_graphs.resnets import net_for_pruning, depthwise_net_for_pruning
label_desc: Use image node_id 2 for calling a global function with example usage: test_pruning(ctx, func_name, seed, threshold, w_bias, channel_last, functions_to_pruning, graph) without return types