code: def save_tensors(collected_tensors, output_directory):
      filenames = []
      for tensor_name, tensor_value in collected_tensors:
          np_filename = os.path.join(
              output_directory, make_safe_filename(tensor_name) + ".npy"
          )
          if isinstance(tensor_value, torch.Tensor):
              # Skip non-tensor collected artifacts, e.g. used_tokens.
              np.save(np_filename, tensor_value.detach().cpu().numpy())
              filenames.append(np_filename)
      return filenames
  
imports: import argparse
  import logging
  import os
  import sys
  from typing import List, Optional, Union
  import numpy
  import torch
  import torchinfo
  from ludwig.api import LudwigModel
  from ludwig.backend import ALL_BACKENDS, Backend
  from ludwig.callbacks import Callback
  from ludwig.constants import FULL, TEST, TRAINING, VALIDATION
  from ludwig.contrib import add_contrib_callback_args
  from ludwig.globals import LUDWIG_VERSION
  from ludwig.utils.print_utils import get_logging_level_registry, print_boxed, print_ludwig
  from ludwig.utils.strings_utils import make_safe_filename
label_desc: Use image node_id 3 for calling a global function with example usage: save_tensors(collected_tensors, output_directory) and returns: filenames