code: def MXNetWrapper(
      mxnet_model,
      convert_inputs: Optional[Callable] = None,
      convert_outputs: Optional[Callable] = None,
      model_class: Type[Model] = Model,
      model_name: str = "mxnet",
  ) -> Model[Any, Any]:
      """Wrap a MXNet model, so that it has the same API as Thinc models.
      To optimize the model, you'll need to create a MXNet optimizer and call
      optimizer.step() after each batch.
  
      Your MXNet model's forward method can take arbitrary args and kwargs,
      but must return either a single tensor as output or a tuple. You may find the
      MXNet register_forward_hook helpful if you need to adapt the output.
  
      The convert functions are used to map inputs and outputs to and from your
      MXNet model. Each function should return the converted output, and a callback
      to use during the backward pass. So:
  
          Xmxnet, get_dX = convert_inputs(X)
          Ymxnet, mxnet_backprop = model.shims[0](Xmxnet, is_train)
          Y, get_dYmxnet = convert_outputs(Ymxnet)
  
      To allow maximum flexibility, the MXNetShim expects ArgsKwargs objects
      on the way into the forward and backward passes. The ArgsKwargs objects
      will be passed straight into the model in the forward pass, and straight
      into `mxnet.autograd.backward` during the backward pass.
      """
      if convert_inputs is None:
          convert_inputs = convert_mxnet_default_inputs
      if convert_outputs is None:
          convert_outputs = convert_mxnet_default_outputs
      return model_class(
          model_name,
          forward,
          attrs={
              "convert_inputs": convert_inputs,
              "convert_outputs": convert_outputs,
          },
          shims=[MXNetShim(mxnet_model)],
      )
  
file_path: thinc/thinc/layers/mxnetwrapper.py
imports: from typing import Any, Callable, Optional, Tuple, Type
  from ..config import registry
  from ..model import Model
  from ..shims import MXNetShim
  from ..types import ArgsKwargs
  from ..util import convert_recursive, is_mxnet_array, is_xp_array, mxnet2xp, xp2mxnet
label_desc: Use image node_id 1 for calling a global function with example usage: MXNetWrapper(mxnet_model, convert_inputs, convert_outputs, model_class, model_name) and returns: model_class