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.
  
  FIXME This works well in eager Python but needs redesign for torchscript.
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",".","FIXME","This","works","well","in","eager","Python","but","needs","redesign","for","torchscript","."]
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, Sequence, Tuple, Union
  import torch
  import torch.nn
  from torch.utils.checkpoint import checkpoint
  from timm.layers import Format
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