class_docstr: Similar to TrainingSampler, but a sample may appear more times than others based
  on its "repeat factor". This is suitable for training on class imbalanced datasets like LVIS.
class_docstr_tok: ["Similar","to","TrainingSampler",",","but","a","sample","may","appear","more","times","than","others","based","on","its","``","repeat","factor","''",".","This","is","suitable","for","training","on","class","imbalanced","datasets","like","LVIS","."]
docstr: Create a list of dataset indices (with repeats) to use for one epoch.
  
  Args:
      generator (torch.Generator): pseudo random number generator used for
          stochastic rounding.
  
  Returns:
      torch.Tensor: list of dataset indices to use in one epoch. Each index
          is repeated based on its calculated repeat factor.
docstr_tok: ["Create","a","list","of","dataset","indices","(","with","repeats",")","to","use","for","one","epoch",".","Args",":","generator","(","torch.Generator",")",":","pseudo","random","number","generator","used","for","stochastic","rounding",".","Returns",":","torch.Tensor",":","list","of","dataset","indices","to","use","in","one","epoch",".","Each","index","is","repeated","based","on","its","calculated","repeat","factor","."]
code: def _get_epoch_indices(self, generator):
      """
      Create a list of dataset indices (with repeats) to use for one epoch.
  
      Args:
          generator (torch.Generator): pseudo random number generator used for
              stochastic rounding.
  
      Returns:
          torch.Tensor: list of dataset indices to use in one epoch. Each index
              is repeated based on its calculated repeat factor.
      """
      # Since repeat factors are fractional, we use stochastic rounding so
      # that the target repeat factor is achieved in expectation over the
      # course of training
      rands = torch.rand(len(self._frac_part), generator=generator)
      rep_factors = self._int_part + (rands < self._frac_part).float()
      # Construct a list of indices in which we repeat images as specified
      indices = []
      for dataset_index, rep_factor in enumerate(rep_factors):
          indices.extend([dataset_index] * int(rep_factor.item()))
      return torch.tensor(indices, dtype=torch.int64)
  
imports: import itertools
  import logging
  import math
  from collections import defaultdict
  from typing import Optional
  import torch
  from torch.utils.data.sampler import Sampler
  from detectron2.utils import comm
label_desc: Use image node_id 3 for calling the RepeatFactorTrainingSampler obj's underlying member method code with example usage: obj._get_epoch_indices(generator) and returns: torch