code: def export_model_to_onnx(
      model: nn.Module,
      model_name: str,
      dummy_input: torch.Tensor,
      **kwargs: Any,
  ) -> str:
      """Export model to ONNX format.
  
      >>> import torch
      >>> from doctr.models.classification import resnet18
      >>> from doctr.models.utils import export_model_to_onnx
      >>> model = resnet18(pretrained=True)
      >>> export_model_to_onnx(model, "my_model", dummy_input=torch.randn(1, 3, 32, 32))
  
      Args:
      ----
          model: the PyTorch model to be exported
          model_name: the name for the exported model
          dummy_input: the dummy input to the model
          kwargs: additional arguments to be passed to torch.onnx.export
  
      Returns:
      -------
          the path to the exported model
      """
      torch.onnx.export(
          model,
          dummy_input,
          f"{model_name}.onnx",
          input_names=["input"],
          output_names=["logits"],
          dynamic_axes={
              "input": {0: "batch_size"},
              "logits": {0: "batch_size"},
          },
          export_params=True,
          verbose=False,
          **kwargs,
      )
      logging.info(f"Model exported to {model_name}.onnx")
      return f"{model_name}.onnx"
  
file_path: doctr/doctr/models/utils/pytorch.py
imports: import logging
  from typing import Any, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from doctr.utils.data import download_from_url
label_desc: Use image node_id 6 for calling a global function with example usage: export_model_to_onnx(model, model_name, dummy_input) and returns: model_name, str