class_docstr: Samples elements sequentially, always in the same order.
  
  Taken from https://github.com/PetrochukM/PyTorch-NLP
  
  Args:
      data (iterable): Iterable data.
      sort_key (callable): Specifies a function of one argument that is used to extract a
          numerical comparison key from each list element.
  
  Example:
      >>> list(SortedSampler(range(10), sort_key=lambda i: -i))
      [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
class_docstr_tok: ["Samples","elements","sequentially",",","always","in","the","same","order",".","Taken","from","https",":","\/\/github.com\/PetrochukM\/PyTorch-NLP","Args",":","data","(","iterable",")",":","Iterable","data",".","sort_key","(","callable",")",":","Specifies","a","function","of","one","argument","that","is","used","to","extract","a","numerical","comparison","key","from","each","list","element",".","Example",":",">",">",">","list","(","SortedSampler","(","range","(","10",")",",","sort_key=lambda","i",":","-i",")",")","[","9",",","8",",","7",",","6",",","5",",","4",",","3",",","2",",","1",",","0","]"]
code: def __init__(self, data, sort_key: Callable = identity):
      super().__init__(data)
      self.data = data
      self.sort_key = sort_key
      zip_ = [
          (i, self.sort_key(row)) for i, row in enumerate(self.data)
      ]
      zip_ = sorted(zip_, key=lambda r: r[1])
      self.sorted_indexes = [item[0] for item in zip_]
  
imports: import math
  import random
  from typing import Callable, List, Union
  from torch.utils.data.sampler import BatchSampler, Sampler, SubsetRandomSampler
label_desc: Use image node_id 1 to create a new SortedSampler object from inherited base classes: Sampler with example: obj = SortedSampler(data, sort_key)