code: def _magc_resnet(
      arch: str,
      pretrained: bool,
      num_blocks: List[int],
      output_channels: List[int],
      stage_stride: List[int],
      stage_conv: List[bool],
      stage_pooling: List[Optional[Tuple[int, int]]],
      ignore_keys: Optional[List[str]] = None,
      **kwargs: Any,
  ) -> ResNet:
      kwargs["num_classes"] = kwargs.get(
          "num_classes", len(default_cfgs[arch]["classes"])
      )
      kwargs["classes"] = kwargs.get(
          "classes", default_cfgs[arch]["classes"]
      )
  
      _cfg = deepcopy(default_cfgs[arch])
      _cfg["num_classes"] = kwargs["num_classes"]
      _cfg["classes"] = kwargs["classes"]
      kwargs.pop("classes")
  
      # Build the model
      model = ResNet(
          num_blocks,
          output_channels,
          stage_stride,
          stage_conv,
          stage_pooling,
          attn_module=partial(MAGC, headers=8, attn_scale=True),
          cfg=_cfg,
          **kwargs,
      )
      # Load pretrained parameters
      if pretrained:
          # The number of classes is not the same as the number of classes in the pretrained model =>
          # remove the last layer weights
          _ignore_keys = (
              ignore_keys
              if kwargs["num_classes"]
              != len(default_cfgs[arch]["classes"])
              else None
          )
          load_pretrained_params(
              model, default_cfgs[arch]["url"], ignore_keys=_ignore_keys
          )
  
      return model
  
file_path: doctr/doctr/models/classification/magc_resnet/pytorch.py
imports: import math
  from copy import deepcopy
  from functools import partial
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from doctr.datasets import VOCABS
  from ...utils.pytorch import load_pretrained_params
  from ..resnet.pytorch import ResNet
label_desc: Use image node_id 1 for calling a global function with example usage: _magc_resnet(arch, pretrained, num_blocks, output_channels, stage_stride, stage_conv, stage_pooling, ignore_keys) and returns: model