code: def _update_first_layer(model, n_in, pretrained):
      "Change first layer based on number of input channels"
      if n_in == 3:
          return
      first_layer, parent, name = _get_first_layer(model)
      assert isinstance(
          first_layer, nn.Conv2d
      ), f"Change of input channels only supported with Conv2d, found {first_layer.__class__.__name__}"
      assert (
          getattr(first_layer, "in_channels") == 3
      ), f'Unexpected number of input channels, found {getattr(first_layer, "in_channels")} while expecting 3'
      params = {
          attr: getattr(first_layer, attr)
          for attr in "out_channels kernel_size stride padding dilation groups padding_mode".split()
      }
      params["bias"] = getattr(first_layer, "bias") is not None
      params["in_channels"] = n_in
      new_layer = nn.Conv2d(**params)
      if pretrained:
          _load_pretrained_weights(new_layer, first_layer)
      setattr(parent, name, new_layer)
  
imports: from __future__ import annotations
  from packaging.version import parse
  from ..basics import *
  from .core import *
  from .data import *
  from .augment import *
  from .None import models
  import torchvision
  from ..callback.hook import num_features_model
label_desc: Use image node_id 5 for calling a global function with example usage: _update_first_layer(model, n_in, pretrained) without return types