class_docstr: This custom DataLoader serves mini-batches that are either fully-observed (i.e. labeled)
  or partially-observed (i.e. unlabeled) but never mixed.
class_docstr_tok: ["This","custom","DataLoader","serves","mini-batches","that","are","either","fully-observed","(","i.e",".","labeled",")","or","partially-observed","(","i.e",".","unlabeled",")","but","never","mixed","."]
code: def _sample_batch_indices(self):
      batch_order = torch.randperm(len(self)).tolist()
      unlabeled_idx = self.unlabeled[torch.randperm(self.num_unlabeled)]
      labeled_idx = self.labeled[torch.randperm(self.num_labeled)]
  
      slices = []
  
      for i in range(self.num_unlabeled_batches):
          _slice = unlabeled_idx[
              i * self.batch_size : (i + 1) * self.batch_size
          ]
          slices.append((_slice, False))
  
      for i in range(self.num_labeled_batches):
          _slice = labeled_idx[
              i * self.batch_size : (i + 1) * self.batch_size
          ]
          slices.append((_slice, True))
  
      return slices, batch_order
  
file_path: pyro/pyro/contrib/examples/scanvi_data.py
imports: import math
  import numpy
  import torch
  import torch.nn
  from scipy import sparse
label_desc: Use image node_id 4 for calling the BatchDataLoader obj's underlying member method code with example usage: obj._sample_batch_indices() and returns: slices,  batch_order