code: def test_subgraph_backend_gluon_ext2(tmpdir):
      class Net(gluon.HybridBlock):
          def __init__(self, **kwargs):
              super(Net, self).__init__(**kwargs)
              self.fc1 = nn.Dense(256)
              self.fc2 = nn.Dense(128)
              self.fc3 = nn.Dense(2)
  
          def forward(self, x):
              x = npx.relu(self.fc1(x))
              x = npx.relu(self.fc2(x))
              return self.fc3(x)
  
      # regular inference
      x = mx.np.random.normal(size=(1, 512), ctx=mx.current_context())
      net = Net()
      net.initialize(ctx=mx.current_context())
      outputs1 = net(x)
      param_path = os.path.join(
          str(tmpdir), "test_subgraph_backend_gluon_ext2.params"
      )
      net.save_parameters(param_path)
  
      # after partitioning
      net = Net()
      net.load_parameters(param_path, ctx=mx.current_context())
      subgraph_backend = "default"
      op_names = ["FullyConnected"]
      check_call(
          _LIB.MXSetSubgraphPropertyOpNamesV2(
              c_str(subgraph_backend),
              mx_uint(len(op_names)),
              c_str_array(op_names),
          )
      )
      net.optimize_for(x, backend=subgraph_backend)
      outputs2 = net(x)
      check_call(
          _LIB.MXRemoveSubgraphPropertyOpNamesV2(
              c_str(subgraph_backend)
          )
      )
  
      # compare outputs
      assert len(outputs1) == len(outputs2)
      for i in range(len(outputs1)):
          assert_almost_equal(
              mx.np.abs(outputs1[i] - outputs2[i]).sum().asnumpy(),
              onp.zeros(shape=(1,)),
          )
  
imports: import os
  import sys
  import ctypes
  import mxnet
  from mxnet.base import SymbolHandle, check_call, _LIB, mx_uint, c_str_array, c_str, mx_real_t
  from mxnet.symbol import Symbol
  import numpy
  from mxnet.test_utils import assert_almost_equal, environment
  from mxnet import gluon
  from mxnet.gluon import nn
  from mxnet import nd, npx
  import pytest
  import tempfile
label_desc: Use image node_id 23 for calling a global function with example usage: test_subgraph_backend_gluon_ext2(tmpdir) and returns: self