code: def test_subgraph_exe9(sym, subgraph_backend, op_names):
      """Call optimize_for to infer shapes, types and dtypes followed by graph partitioning and
      dedup subgraph, then bind and compare results of the partitioned sym and the original sym.
      """
      # bind
      sym, _, _ = sym
      arg_shapes, _, aux_shapes = sym.infer_shape()
      arg_names = sym.list_arguments()
      aux_names = sym.list_auxiliary_states()
      arg_dict = {
          name: mx.nd.random.uniform(shape=shape)
          for name, shape in zip(arg_names, arg_shapes)
      }
      aux_dict = {
          name: mx.nd.random.uniform(shape=shape)
          for name, shape in zip(aux_names, aux_shapes)
      }
      exe1 = sym._bind(
          ctx=mx.current_context(),
          args=arg_dict,
          aux_states=aux_dict,
          grad_req="null",
      )
      exe1.forward()
  
      # infer shape/type before partition before bind
      check_call(
          _LIB.MXSetSubgraphPropertyOpNamesV2(
              c_str(subgraph_backend),
              mx_uint(len(op_names)),
              c_str_array(op_names),
          )
      )
      part_sym = sym.optimize_for(
          subgraph_backend, arg_dict, aux_dict, dedup_subgraph=True
      )
      check_call(
          _LIB.MXRemoveSubgraphPropertyOpNamesV2(
              c_str(subgraph_backend)
          )
      )
  
      exe2 = part_sym._bind(
          ctx=mx.current_context(),
          args=arg_dict,
          aux_states=aux_dict,
          grad_req="null",
      )
      exe2.forward()
  
      # compare outputs
      outputs1 = exe1.outputs
      outputs2 = exe2.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 20 for calling a global function with example usage: test_subgraph_exe9(sym, subgraph_backend, op_names) without return types