code: def test_feature_extraction_methods_equivalence(self):
      model = models.resnet18(**self.model_defaults).eval()
      return_layers = {
          "layer1": "layer1",
          "layer2": "layer2",
          "layer3": "layer3",
          "layer4": "layer4",
      }
  
      ilg_model = IntermediateLayerGetter(model, return_layers).eval()
      fx_model = self._create_feature_extractor(model, return_layers)
  
      # Check that we have same parameters
      for (n1, p1), (n2, p2) in zip(
          ilg_model.named_parameters(), fx_model.named_parameters()
      ):
          assert n1 == n2
          assert p1.equal(p2)
  
      # And that outputs match
      with torch.no_grad():
          ilg_out = ilg_model(self.inp)
          fgn_out = fx_model(self.inp)
      assert all(
          k1 == k2 for k1, k2 in zip(ilg_out.keys(), fgn_out.keys())
      )
      for k in ilg_out.keys():
          assert ilg_out[k].equal(fgn_out[k])
  
imports: import random
  from itertools import chain
  from typing import Mapping, Sequence
  import pytest
  import torch
  from common_utils import set_rng_seed
  from torchvision import models
  from torchvision.models._utils import IntermediateLayerGetter
  from torchvision.models.detection.backbone_utils import BackboneWithFPN, mobilenet_backbone, resnet_fpn_backbone
  from torchvision.models.feature_extraction import create_feature_extractor, get_graph_node_names
label_desc: Use image node_id 6 for calling the TestFxFeatureExtraction obj's underlying member method code with example usage: obj.test_feature_extraction_methods_equivalence() without return types