code: def _assert_dc_gluon(
      setup,
      net,
      setup_is_deterministic=True,
      numpy=True,
      autograd=True,
      device=None,
  ):
      """Compare results of deferred compute and normal imperative mode.
  
      Parameters
      ----------
      setup : callable
          Setup function computing inputs for compute function. Always called
          outside of deferred compute.
      net : Block
      setup_is_deterministic : bool
          If True, setup function may be called multiple times. If False, will
          only be called once.
      numpy : bool
          If True, use mx.np. Otherwise mx.nd.
      autograd : bool
          Wrap in autograd
  
      """
  
      nd = mx.np if numpy else mx.nd
  
      if device is None:
          device = mx.device.current_device()
      with device:
          xs = setup(nd=nd)
  
      ys = net(*xs)
      ys_np = [y.asnumpy() for y in ys]
  
      net.hybridize()
      if setup_is_deterministic:
          xs = setup(nd=nd)
  
      if autograd:
          with mx.autograd.record():
              ys_hybrid = net(*xs)
          mx.autograd.backward(ys_hybrid)
          [p.grad() for p in net.collect_params().values()]
      else:
          ys_hybrid = net(*xs)
  
      assert all(
          isinstance(y, mx.numpy.ndarray)
          if numpy
          else isinstance(y, mx.ndarray.ndarray.NDArray)
          for y in ys_hybrid
      )
  
      ys_hybrid_np = [y.asnumpy() for y in ys_hybrid]
  
      _all_same(ys_np, ys_hybrid_np)
  
      with TemporaryDirectory() as root:
          with mx.util.np_shape(True), mx.util.np_array(True):
              net.export(root)
  
imports: import functools
  import operator
  import numpy
  import mxnet
  import mxnet._deferred_compute
  from mxnet.base import MXNetError
  from mxnet.util import TemporaryDirectory
  import pytest
label_desc: Use image node_id 29 for calling a global function with example usage: _assert_dc_gluon(setup, net, setup_is_deterministic, numpy, autograd, device) without return types