code: def _save_knn_results(
      output_dir: str,
      layer_name: str,
      output_inds: List[int],
      output_predicted_label: List[np.ndarray],
      output_targets: List[np.ndarray],
  ):
      output_targets = np.vstack(output_targets)
      output_predicted_label = np.vstack(output_predicted_label)
      logging.info(
          f"Saving targets: {output_targets.shape}, "
          f"output predictions: {output_predicted_label.shape}, "
          f"output indices: {len(output_inds)}"
      )
      save_file(
          output_predicted_label,
          f"{output_dir}/kNN_{layer_name}_output_predictions.npy",
      )
      save_file(
          output_targets,
          f"{output_dir}/kNN_{layer_name}_output_targets.npy",
      )
      save_file(
          output_inds,
          f"{output_dir}/kNN_{layer_name}_output_image_indices.npy",
      )
  
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 4 for calling a global function with example usage: _save_knn_results(output_dir, layer_name, output_inds, output_predicted_label, output_targets) without return types