code: def run_knn_at_all_layers(config: AttrDict):
      """
      Get the names of the features that we are extracting. If user doesn't
      specify the features to evaluate, we get the full model output and freeze
      head/trunk both as caution.
      """
      feat_names = get_trunk_output_feature_names(config.MODEL)
      if len(feat_names) == 0:
          feat_names = ["heads"]
  
      top_k_list = config.NEAREST_NEIGHBOR.TOPK
      if not isinstance(top_k_list, list):
          top_k_list = [top_k_list]
  
      for layer in feat_names:
          # TODO - replace this with more optimal approach:
          #  * use the max top_k to select the closest neighbors
          #  * then only at the end, sub-select the different top_k
          #    to compute the accuracy for each different top_k
          for top_k in top_k_list:
              config.NEAREST_NEIGHBOR.TOPK = top_k
              if config.NEAREST_NEIGHBOR.OPTIMIZE_MEMORY:
                  top1, top5, _ = run_knn_at_layer_low_memory(
                      config, layer_name=layer
                  )
              else:
                  top1, top5, _ = run_knn_at_layer(
                      config, layer_name=layer
                  )
              logging.info(
                  f"layer: {layer}, topk: {top_k}, Top1: {top1}, Top5: {top5}"
              )
  
imports: import logging
  from typing import List, NamedTuple
  import numpy
  import torch
  from torch import nn
  from vissl.config import AttrDict
  from vissl.hooks import default_hook_generator
  from vissl.models.model_helpers import get_trunk_output_feature_names
  from vissl.utils.checkpoint import get_checkpoint_folder
  from vissl.utils.distributed_launcher import create_submitit_executor, launch_distributed
  from vissl.utils.env import set_env_vars
  from vissl.utils.extract_features_utils import ExtractedFeaturesLoader
  from vissl.utils.hydra_config import print_cfg
  from vissl.utils.io import save_file
  from vissl.utils.logger import setup_logging, shutdown_logging
label_desc: Use image node_id 5 for calling a global function with example usage: run_knn_at_all_layers(config) without return types