code: def generate_voc07_low_shot_samples(
      targets, k_values, sample_inds, output_path, layername
  ):
      k_values = [int(val) for val in k_values]
      # the way sample works is: for each independent sample, and a given k value
      # we create a matrix of the same shape as given targets file. We initialize
      # this matrix with -1 (ignore label). We then sample k positive and
      # (num_classes-1) * k negatives.
  
      num_classes = targets.shape[1]  # N x 20 shape
      for idx in sample_inds:
          for k in k_values:
              logging.info(f"Sampling: {idx} time for k-value: {k}")
              output = np.ones(targets.shape, dtype=np.int32) * -1
              output = sample_symbol(targets, output, 1, k)
              output = sample_symbol(
                  targets, output, 0, (num_classes - 1) * k
              )
              output_file = (
                  f"{output_path}/{layername}_sample{idx}_k{k}.npy"
              )
              logging.info(f"Saving file: {output_file}")
              save_file(output, output_file)
      logging.info("Done!!")
  
file_path: vissl/extra_scripts/create_low_shot_samples.py
imports: import argparse
  import logging
  import random
  import numpy
  from iopath.common.file_io import g_pathmgr
  from vissl.utils.io import load_file, save_file
label_desc: Use image node_id 2 for calling a global function with example usage: generate_voc07_low_shot_samples(targets, k_values, sample_inds, output_path, layername) without return types