code: def _update_default_model_kwargs(
      pretrained_cfg, kwargs, kwargs_filter
  ):
      """Update the default_cfg and kwargs before passing to model
  
      Args:
          pretrained_cfg: input pretrained cfg (updated in-place)
          kwargs: keyword args passed to model build fn (updated in-place)
          kwargs_filter: keyword arg keys that must be removed before model __init__
      """
      # Set model __init__ args that can be determined by default_cfg (if not already passed as kwargs)
      default_kwarg_names = ("num_classes", "global_pool", "in_chans")
      if pretrained_cfg.get("fixed_input_size", False):
          # if fixed_input_size exists and is True, model takes an img_size arg that fixes its input size
          default_kwarg_names += ("img_size",)
  
      for n in default_kwarg_names:
          # for legacy reasons, model __init__args uses img_size + in_chans as separate args while
          # pretrained_cfg has one input_size=(C, H ,W) entry
          if n == "img_size":
              input_size = pretrained_cfg.get("input_size", None)
              if input_size is not None:
                  assert len(input_size) == 3
                  kwargs.setdefault(n, input_size[-2:])
          elif n == "in_chans":
              input_size = pretrained_cfg.get("input_size", None)
              if input_size is not None:
                  assert len(input_size) == 3
                  kwargs.setdefault(n, input_size[0])
          elif n == "num_classes":
              default_val = pretrained_cfg.get(n, None)
              # if default is < 0, don't pass through to model
              if default_val is not None and default_val >= 0:
                  kwargs.setdefault(n, pretrained_cfg[n])
          else:
              default_val = pretrained_cfg.get(n, None)
              if default_val is not None:
                  kwargs.setdefault(n, pretrained_cfg[n])
  
      # Filter keyword args for task specific model variants (some 'features only' models, etc.)
      _filter_kwargs(kwargs, names=kwargs_filter)
  
imports: import dataclasses
  import logging
  import os
  from copy import deepcopy
  from typing import Optional, Dict, Callable, Any, Tuple
  from torch import nn
  from torch.hub import load_state_dict_from_url
  from timm.models._features import FeatureListNet, FeatureHookNet
  from timm.models._features_fx import FeatureGraphNet
  from timm.models._helpers import load_state_dict
  from timm.models._hub import has_hf_hub, download_cached_file, check_cached_file, load_state_dict_from_hf
  from timm.models._manipulate import adapt_input_conv
  from timm.models._pretrained import PretrainedCfg
  from timm.models._prune import adapt_model_from_file
  from timm.models._registry import get_pretrained_cfg
label_desc: Use image node_id 8 for calling a global function with example usage: _update_default_model_kwargs(pretrained_cfg, kwargs, kwargs_filter) without return types