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 __iter__(self):
      slices, batch_order = self._sample_batch_indices()
  
      for i in range(len(batch_order)):
          _slice = slices[batch_order[i]]
          if _slice[1]:
              # labeled
              yield self.data_x[_slice[0]], nn.functional.one_hot(
                  self.data_y[_slice[0]], num_classes=self.num_classes
              )
          else:
              # unlabeled
              yield self.data_x[_slice[0]], None
  
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 5 for calling the BatchDataLoader obj's underlying member method code with example usage: obj.__iter__() without return types