class_docstr: Assign each data sample to a fixed bucket based on its length.
  The bucket keys are either given or generated from the input sequence lengths.
  
  Parameters
  ----------
  lengths
      The length of the sequences in the input data sample.
  batch_size
      The expected batch size of the sampler.
  num_buckets : int or None, default 10
      The number of buckets. This will not be used if bucket_keys is set.
  bucket_keys
      The keys that will be used to create the buckets. It should usually be the lengths of the
      sequences. If it is None, the bucket_keys will be generated based on the bucket schemes
      given input lengths.
  ratio
      Ratio to scale up the batch size of smaller buckets.
      Assume the :math:`i` th key is :math:`K_i` ,
      the default batch size is :math:`B` , the ratio to scale the batch size is
      :math:`\alpha` and
      the batch size corresponds to the :math:`i` th bucket is :math:`B_i` . We have:
  
      .. math::
  
          B_i = \max(\alpha B \times \frac{\max_j sum(K_j)}{sum(K_i)}, B)
  
      Thus, setting this to a value larger than 0, like 0.5, will scale up the batch size of the
      smaller buckets.
  shuffle
      Whether to shuffle the batches.
  use_average_length
      False: each batch contains batch_size sequences, number of sequence elements varies.
      True: each batch contains batch_size elements, number of sequences varies. In this case,
      ratio option is ignored.
  bucket_scheme
      It is used to generate bucket keys. It supports:
      ConstWidthBucket: all the buckets have the same width
      LinearWidthBucket: the width of ith  bucket follows :math:`w_i = \alpha * i + 1`
      ExpWidthBucket: the width of ith bucket follows
      :math:`w_i` = bucket_len_step :math:`* w_{i-1}`
  seed
      The seed of the bucket sampler
  Examples
  --------
  >>> lengths = [np.random.randint(1, 100) for _ in range(1000)]
  >>> sampler = gluonnlp.data.FixedBucketSampler(lengths, 8, ratio=0.5)
  >>> print(sampler)
  FixedBucketSampler:
  -etc-
class_docstr_tok: ["Assign","each","data","sample","to","a","fixed","bucket","based","on","its","length",".","The","bucket","keys","are","either","given","or","generated","from","the","input","sequence","lengths",".","Parameters","--","--","--","--","--","lengths","The","length","of","the","sequences","in","the","input","data","sample",".","batch_size","The","expected","batch","size","of","the","sampler",".","num_buckets",":","int","or","None",",","default","10","The","number","of","buckets",".","This","will","not","be","used","if","bucket_keys","is","set",".","bucket_keys","The","keys","that","will","be","used","to","create","the","buckets",".","It","should","usually","be","the","lengths","of","the","sequences",".","If","it","is","None",",","the","bucket_keys","will","be","generated","based","on","the","bucket","schemes","given","input","lengths",".","ratio","Ratio","to","scale","up","the","batch","size","of","smaller","buckets",".","Assume","the",":","math",":","`","i","`","th","key","is",":","math",":","`","K_i","`",",","the","default","batch","size","is",":","math",":","`","B","`",",","the","ratio","to","scale","the","batch","size","is",":","math",":","`","\\alpha","`","and","the","batch","size","corresponds","to","the",":","math",":","`","i","`","th","bucket","is",":","math",":","`","B_i","`",".","We","have",":","..","math",":",":","B_i","=","\\max","(","\\alpha","B","\\times","\\frac","{","\\max_j","sum","(","K_j",")","}","{","sum","(","K_i",")","}",",","B",")","Thus",",","setting","this","to","a","value","larger","than","0",",","like","0.5",",","will","scale","up","the","batch","size","of","the","smaller","buckets",".","shuffle","Whether","to","shuffle","the","batches",".","use_average_length","False",":","each","batch","contains","batch_size","sequences",",","number","of","sequence","elements","varies",".","True",":","each","batch","contains","batch_size","elements",",","number","of","sequences","varies",".","In","this","case",",","ratio","option","is","ignored",".","bucket_scheme","It","is","used","to","generate","bucket","keys",".","It","supports",":","ConstWidthBucket",":","all","the","buckets","have","the","same","width","LinearWidthBucket",":","the","width","of","ith","bucket","follows",":","math",":","`","w_i","=","\\alpha","*","i","+","1","`","ExpWidthBucket",":","the","width","of","ith","bucket","follows",":","math",":","`","w_i","`","=","bucket_len_step",":","math",":","`","*","w_","{","i-1","}","`","seed","The","seed","of","the","bucket","sampler","Examples","--","--","--","--",">",">",">","lengths","=","[","np.random.randint","(","1",",","100",")","for","_","in","range","(","1000",")","]",">",">",">","sampler","=","gluonnlp.data.FixedBucketSampler","(","lengths",",","8",",","ratio=0.5",")",">",">",">","print","(","sampler",")","FixedBucketSampler",":","-etc-"]
docstr: Return a string representing the statistics of the bucketing sampler.
  
  Returns
  -------
  ret : str
      String representing the statistics of the buckets.
docstr_tok: ["Return","a","string","representing","the","statistics","of","the","bucketing","sampler",".","Returns","--","--","--","-","ret",":","str","String","representing","the","statistics","of","the","buckets","."]
code: def __repr__(self):
      """Return a string representing the statistics of the bucketing sampler.
  
      Returns
      -------
      ret : str
          String representing the statistics of the buckets.
      """
      ret = (
          "{name}(\n"
          "  sample_num={sample_num}, batch_num={batch_num}\n"
          "  key={bucket_keys}\n"
          "  cnt={bucket_counts}\n"
          "  batch_size={bucket_batch_sizes}\n"
          ")".format(
              name=self.__class__.__name__,
              sample_num=len(self._lengths),
              batch_num=len(self._batch_infos),
              bucket_keys=self._bucket_keys,
              bucket_counts=[
                  len(sample_ids)
                  for sample_ids in self._bucket_sample_ids
              ],
              bucket_batch_sizes=self._bucket_batch_sizes,
          )
      )
      return ret
  
imports: import math
  import random
  import warnings
  import numpy
  import abc
  import logging
  from typing import Union, Sequence, Optional, List
  from ..base import INT_TYPES
label_desc: Use image node_id 4 for calling the FixedBucketSampler obj's underlying member method code with example usage: obj.__repr__() and returns: ret