class_docstr: Feature Hook Helper
  This module helps with the setup and extraction of hooks for extracting features from
  internal nodes in a model by node name. This works quite well in eager Python but needs
  redesign for torcscript.
class_docstr_tok: ["Feature","Hook","Helper","This","module","helps","with","the","setup","and","extraction","of","hooks","for","extracting","features","from","internal","nodes","in","a","model","by","node","name",".","This","works","quite","well","in","eager","Python","but","needs","redesign","for","torcscript","."]
code: def _collect_output_hook(self, hook_id, *args):
      x = args[
          -1
      ]  # tensor we want is last argument, output for fwd, input for fwd_pre
      if isinstance(x, tuple):
          x = x[0]  # unwrap input tuple
      self._feature_outputs[x.device][hook_id] = x
  
imports: from collections import OrderedDict, defaultdict
  from copy import deepcopy
  from functools import partial
  from typing import Dict, List, Tuple
  import torch
  import torch.nn
label_desc: Use image node_id 2 for calling the FeatureHooks obj's underlying member method code with example usage: obj._collect_output_hook(hook_id) without return types