class_docstr: Sampler that supports for bucketization and token-level batchification.
  
  Args:
      buckets (dict):
          A dict that maps each centroid to indices of clustered sentences.
          The centroid corresponds to the average length of all sentences in the bucket.
      batch_size (int):
          Token-level batch size. The resulting batch contains roughly the same number of tokens as ``batch_size``.
      shuffle (bool):
          If ``True``, the sampler will shuffle both buckets and samples in each bucket. Default: ``False``.
      distributed (bool):
          If ``True``, the sampler will be used in conjunction with :class:`torch.nn.parallel.DistributedDataParallel`
          that restricts data loading to a subset of the dataset.
          Default: ``False``.
class_docstr_tok: ["Sampler","that","supports","for","bucketization","and","token-level","batchification",".","Args",":","buckets","(","dict",")",":","A","dict","that","maps","each","centroid","to","indices","of","clustered","sentences",".","The","centroid","corresponds","to","the","average","length","of","all","sentences","in","the","bucket",".","batch_size","(","int",")",":","Token-level","batch","size",".","The","resulting","batch","contains","roughly","the","same","number","of","tokens","as","``","batch_size","``",".","shuffle","(","bool",")",":","If","``","True","``",",","the","sampler","will","shuffle","both","buckets","and","samples","in","each","bucket",".","Default",":","``","False","``",".","distributed","(","bool",")",":","If","``","True","``",",","the","sampler","will","be","used","in","conjunction","with",":","class",":","`","torch.nn.parallel.DistributedDataParallel","`","that","restricts","data","loading","to","a","subset","of","the","dataset",".","Default",":","``","False","``","."]
code: def __len__(self):
      return self.samples
  
imports: import torch
  import torch.distributed
  from underthesea.utils.sp_alg import kmeans
label_desc: Use image node_id 3 for calling the Sampler obj's underlying member method code with example usage: obj.__len__() and returns: self