class_docstr: Abstract dataset class. All datasets should have this interface.
  
  Subclasses need to override `__getitem__`, which returns the i-th
  element, and `__len__`, which returns the total number elements.
  
  .. note:: An mxnet or numpy array can be directly used as a dataset.
docstr: Returns a new dataset with samples filtered by the
  filter function `fn`.
  
  Note that if the Dataset is the result of a lazily transformed one with
  transform(lazy=False), the filter is eagerly applied to the transformed
  samples without materializing the transformed result. That is, the
  transformation will be applied again whenever a sample is retrieved after
  filter().
  
  Parameters
  ----------
  fn : callable
      A filter function that takes a sample as input and
      returns a boolean. Samples that return False are discarded.
  
  Returns
  -------
  Dataset
      The filtered dataset.
docstr_tok: ["Returns","a","new","dataset","with","samples","filtered","by","the","filter","function","`","fn","`",".","Note","that","if","the","Dataset","is","the","result","of","a","lazily","transformed","one","with","transform","(","lazy=False",")",",","the","filter","is","eagerly","applied","to","the","transformed","samples","without","materializing","the","transformed","result",".","That","is",",","the","transformation","will","be","applied","again","whenever","a","sample","is","retrieved","after","filter","(",")",".","Parameters","--","--","--","--","--","fn",":","callable","A","filter","function","that","takes","a","sample","as","input","and","returns","a","boolean",".","Samples","that","return","False","are","discarded",".","Returns","--","--","--","-","Dataset","The","filtered","dataset","."]
code: def filter(self, fn):
      """Returns a new dataset with samples filtered by the
      filter function `fn`.
  
      Note that if the Dataset is the result of a lazily transformed one with
      transform(lazy=False), the filter is eagerly applied to the transformed
      samples without materializing the transformed result. That is, the
      transformation will be applied again whenever a sample is retrieved after
      filter().
  
      Parameters
      ----------
      fn : callable
          A filter function that takes a sample as input and
          returns a boolean. Samples that return False are discarded.
  
      Returns
      -------
      Dataset
          The filtered dataset.
      """
      from . import FilterSampler
  
      return _SampledDataset(self, FilterSampler(fn, self))
  
imports: import os
  from ...None import recordio, ndarray
  from ...util import default_array
label_desc: Use image node_id 3 for calling the Dataset obj's underlying member method code with example usage: obj.filter(fn) and returns: _SampledDataset