code: def inflate_weight(state_dict_2d, state_dict_3d):
      """
      Inflate 2D model weights in state_dict_2d to the 3D model weights in
      state_dict_3d. The details can be found in:
      Joao Carreira, and Andrew Zisserman.
      "Quo vadis, action recognition? a new model and the kinetics dataset."
      Args:
          state_dict_2d (OrderedDict): a dict of parameters from a 2D model.
          state_dict_3d (OrderedDict): a dict of parameters from a 3D model.
      Returns:
          state_dict_inflated (OrderedDict): a dict of inflated parameters.
      """
      state_dict_inflated = OrderedDict()
      for k, v2d in state_dict_2d.items():
          assert k in state_dict_3d.keys()
          v3d = state_dict_3d[k]
          # Inflate the weight of 2D conv to 3D conv.
          if len(v2d.shape) == 4 and len(v3d.shape) == 5:
              logger.info(
                  "Inflate {}: {} -> {}: {}".format(
                      k, v2d.shape, k, v3d.shape
                  )
              )
              # Dimension need to be match.
              assert v2d.shape[-2:] == v3d.shape[-2:]
              assert v2d.shape[:2] == v3d.shape[:2]
              v3d = (
                  v2d.unsqueeze(2).repeat(1, 1, v3d.shape[2], 1, 1)
                  / v3d.shape[2]
              )
          elif v2d.shape == v3d.shape:
              v3d = v2d
          else:
              logger.info(
                  "Unexpected {}: {} -|> {}: {}".format(
                      k, v2d.shape, k, v3d.shape
                  )
              )
          state_dict_inflated[k] = v3d.clone()
      return state_dict_inflated
  
imports: import copy
  import math
  import numpy
  import os
  import pickle
  from collections import OrderedDict
  import torch
  import slowfast.utils.distributed
  import slowfast.utils.logging
  from slowfast.utils.c2_model_loading import get_name_convert_func
  from slowfast.utils.env import checkpoint_pathmgr
label_desc: Use image node_id 8 for calling a global function with example usage: inflate_weight(state_dict_2d, state_dict_3d) and returns: state_dict_inflated