code: def test_set_classy_state_weight_inflation(self):
      # Get model state from a 2D ResNet model, inflate the 2D conv weights,
      # and use them to initialize 3D conv weights. This is an advanced use of
      # `set_classy_state` method.
      (
          model_2d_config,
          model_3d_config,
      ) = self._get_model_config_weight_inflation()
      model_2d = build_model(model_2d_config)
      model_2d_state = model_2d.get_classy_state()
  
      model_3d = build_model(model_3d_config)
      model_3d.set_classy_state(model_2d_state)
      model_3d_state = model_3d.get_classy_state()
  
      for name, weight_2d in model_2d_state["model"]["trunk"].items():
          weight_3d = model_3d_state["model"]["trunk"][name]
          if weight_2d.dim() == 5:
              # inflation only applies to conv weights
              self.assertEqual(weight_3d.dim(), 5)
              if weight_2d.shape[2] == 1 and weight_3d.shape[2] > 1:
                  weight_2d_inflated = (
                      weight_2d.repeat(1, 1, weight_3d.shape[2], 1, 1)
                      / weight_3d.shape[2]
                  )
                  self.assertTrue(
                      torch.equal(weight_3d, weight_2d_inflated)
                  )
  
file_path: ClassyVision/test/models_resnext3d_test.py
imports: import copy
  import unittest
  import torch
  from classy_vision.models import build_model, ClassyModel
  from test.generic.utils import compare_model_state
label_desc: Use image node_id 6 for calling the TestResNeXt3D obj's underlying member method code with example usage: obj.test_set_classy_state_weight_inflation() without return types