class_docstr: A dataset that provides helpers for batching.
class_docstr_tok: ["A","dataset","that","provides","helpers","for","batching","."]
docstr: Filter a list of sample indices. Remove those that are longer than
  specified in *max_sizes*.
  
  WARNING: don't update, override method in child classes
  
  Args:
      indices (np.array): original array of sample indices
      max_sizes (int or list[int] or tuple[int]): max sample size,
          can be defined separately for src and tgt (then list or tuple)
  
  Returns:
      np.array: filtered sample array
      list: list of removed indices
docstr_tok: ["Filter","a","list","of","sample","indices",".","Remove","those","that","are","longer","than","specified","in","*","max_sizes","*",".","WARNING",":","do","n't","update",",","override","method","in","child","classes","Args",":","indices","(","np.array",")",":","original","array","of","sample","indices","max_sizes","(","int","or","list","[","int","]","or","tuple","[","int","]",")",":","max","sample","size",",","can","be","defined","separately","for","src","and","tgt","(","then","list","or","tuple",")","Returns",":","np.array",":","filtered","sample","array","list",":","list","of","removed","indices"]
code: def filter_indices_by_size(self, indices, max_sizes):
      """
      Filter a list of sample indices. Remove those that are longer than
      specified in *max_sizes*.
  
      WARNING: don't update, override method in child classes
  
      Args:
          indices (np.array): original array of sample indices
          max_sizes (int or list[int] or tuple[int]): max sample size,
              can be defined separately for src and tgt (then list or tuple)
  
      Returns:
          np.array: filtered sample array
          list: list of removed indices
      """
      if isinstance(max_sizes, float) or isinstance(max_sizes, int):
          if hasattr(self, "sizes") and isinstance(
              self.sizes, np.ndarray
          ):
              ignored = indices[
                  self.sizes[indices] > max_sizes
              ].tolist()
              indices = indices[self.sizes[indices] <= max_sizes]
          elif (
              hasattr(self, "sizes")
              and isinstance(self.sizes, list)
              and len(self.sizes) == 1
          ):
              ignored = indices[
                  self.sizes[0][indices] > max_sizes
              ].tolist()
              indices = indices[self.sizes[0][indices] <= max_sizes]
          else:
              indices, ignored = data_utils._filter_by_size_dynamic(
                  indices, self.size, max_sizes
              )
      else:
          indices, ignored = data_utils._filter_by_size_dynamic(
              indices, self.size, max_sizes
          )
      return indices, ignored
  
imports: import logging
  import numpy
  import torch.utils.data
  from fairseq.data import data_utils
label_desc: Use image node_id 13 for calling the FairseqDataset obj's underlying member method code with example usage: obj.filter_indices_by_size(indices, max_sizes) and returns: indices,  ignored