code: def test_subgraph_backend_gluon(
      sym, subgraph_backend, op_names, tmp_path
  ):
      """Call hybridize() to partition the graph, and then compare results of the partitioned
      sym and the original sym. Here do an inference before hybridizing with the subgraph_backend
      which means we'll pass shapes/types"""
      # create Gluon block for given symbol
      inputs = [mx.sym.var(i, dtype=mx_real_t) for i in sym[1]]
      sym_block = nn.SymbolBlock(sym[0], inputs)
      sym_block.initialize(ctx=mx.current_context())
      x = [
          mx.nd.random.uniform(shape=s, ctx=mx.current_context())
          for s in sym[2]
      ]
      # hybridize and export to get baseline
      sym_block.hybridize()
      outputs1 = sym_block(*x)
  
      sym_filename, params_filename = sym_block.export(
          str(tmp_path / "sym-block")
      )
  
      # load model and partition
      sym_block = nn.SymbolBlock.imports(
          sym_filename,
          sym[1],
          params_filename,
          ctx=mx.current_context(),
      )
      check_call(
          _LIB.MXSetSubgraphPropertyOpNamesV2(
              c_str(subgraph_backend),
              mx_uint(len(op_names)),
              c_str_array(op_names),
          )
      )
      sym_block.optimize_for(*x, backend=subgraph_backend)
      outputs2 = sym_block(*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(
              (outputs1[i] - outputs2[i]).abs().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 21 for calling a global function with example usage: test_subgraph_backend_gluon(sym, subgraph_backend, op_names, tmp_path) without return types