class_docstr: _Sampler decides the order of batches to read from a Keras Sequence, similar to a PyTorch
  Sampler object.  In a data loader, there is one _Sampler in the main thread/process that
  decides the order of data loading for all the dataloader worker threads/processes.
  
  _Sampler therefore makes it possible to shuffle indices without concern for synchronous access,
  as is the case when trying to implement shuffle from inside of a Keras Sequence inside of the
  real Keras OrderedEnqueuer.
class_docstr_tok: ["_Sampler","decides","the","order","of","batches","to","read","from","a","Keras","Sequence",",","similar","to","a","PyTorch","Sampler","object",".","In","a","data","loader",",","there","is","one","_Sampler","in","the","main","thread\/process","that","decides","the","order","of","data","loading","for","all","the","dataloader","worker","threads\/processes",".","_Sampler","therefore","makes","it","possible","to","shuffle","indices","without","concern","for","synchronous","access",",","as","is","the","case","when","trying","to","implement","shuffle","from","inside","of","a","Keras","Sequence","inside","of","the","real","Keras","OrderedEnqueuer","."]
docstr: The _Sampler is stateful, and _epoch_end is where it modifies it state after each epoch.
docstr_tok: ["The","_Sampler","is","stateful",",","and","_epoch_end","is","where","it","modifies","it","state","after","each","epoch","."]
code: def _end_epoch(self) -> None:
      """
      The _Sampler is stateful, and _epoch_end is where it modifies it state after each epoch.
      """
      # Recalculate this shard's offset.
      self.offset = (self.offset - len(self.indices)) % self.num_shards
      # Reshuffle indices.
      if self.shuffle:
          self.rng.shuffle(self.indices)
  
imports: import abc
  import collections
  import multiprocessing
  import multiprocessing.queues
  import queue
  import threading
  from typing import Any, Deque, Dict, Iterator, Optional, Type, Union
  import numpy
  import tensorflow
  from determined.common import check
label_desc: Use image node_id 3 for calling the _Sampler obj's underlying member method code with example usage: obj._end_epoch() without return types