code: def get_ss_indices_per_class(y, sup_per_class):
      # number of indices to consider
      n_idxs = y.size()[0]
  
      # calculate the indices per class
      idxs_per_class = {j: [] for j in range(10)}
  
      # for each index identify the class and add the index to the right class
      for i in range(n_idxs):
          curr_y = y[i]
          for j in range(10):
              if curr_y[j] == 1:
                  idxs_per_class[j].append(i)
                  break
  
      idxs_sup = []
      idxs_unsup = []
      for j in range(10):
          np.random.shuffle(idxs_per_class[j])
          idxs_sup.extend(idxs_per_class[j][:sup_per_class])
          idxs_unsup.extend(
              idxs_per_class[j][sup_per_class : len(idxs_per_class[j])]
          )
  
      return idxs_sup, idxs_unsup
  
file_path: pyro/examples/vae/utils/mnist_cached.py
imports: import errno
  import os
  from functools import reduce
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from pyro.contrib.examples.util import MNIST, get_data_directory
label_desc: Use image node_id 3 for calling a global function with example usage: get_ss_indices_per_class(y, sup_per_class) and returns: idxs_sup,  idxs_unsup