class_docstr: Module wrapper that returns intermediate layers from a model
  It has a strong assumption that the modules have been registered
  into the model in the same order as they are used.
  This means that one should **not** reuse the same nn.Module
  twice in the forward if you want this to work.
  Additionally, it is only able to query submodules that are directly
  assigned to the model. So if `model` is passed, `model.feature1` can
  be returned, but not `model.feature1.layer2`.
  Arguments:
      model (nn.Module): model on which we will extract the features
      return_layers (Dict[name, new_name]): a dict containing the names
          of the modules for which the activations will be returned as
          the key of the dict, and the value of the dict is the name
          of the returned activation (which the user can specify).
class_docstr_tok: ["Module","wrapper","that","returns","intermediate","layers","from","a","model","It","has","a","strong","assumption","that","the","modules","have","been","registered","into","the","model","in","the","same","order","as","they","are","used",".","This","means","that","one","should","*","*","not","*","*","reuse","the","same","nn.Module","twice","in","the","forward","if","you","want","this","to","work",".","Additionally",",","it","is","only","able","to","query","submodules","that","are","directly","assigned","to","the","model",".","So","if","`","model","`","is","passed",",","`","model.feature1","`","can","be","returned",",","but","not","`","model.feature1.layer2","`",".","Arguments",":","model","(","nn.Module",")",":","model","on","which","we","will","extract","the","features","return_layers","(","Dict","[","name",",","new_name","]",")",":","a","dict","containing","the","names","of","the","modules","for","which","the","activations","will","be","returned","as","the","key","of","the","dict",",","and","the","value","of","the","dict","is","the","name","of","the","returned","activation","(","which","the","user","can","specify",")","."]
code: def forward(self, x):
      out = OrderedDict()
      # 依次遍历模型的所有子模块，并进行正向传播，
      # 收集layer1, layer2, layer3, layer4的输出
      for name, module in self.items():
          x = module(x)
          if name in self.return_layers:
              out_name = self.return_layers[name]
              out[out_name] = x
      return out
  
imports: from collections import OrderedDict
  import torch.nn
  import torch
  from torch import Tensor
  import torch.nn.functional
  from torch.jit.annotations import Tuple, List, Dict
label_desc: Use image node_id 2 for calling the IntermediateLayerGetter obj's underlying member method code with example usage: obj.forward(x) and returns: out