parameters: (self, input_dataset, predicate)
docstring: See `Dataset.filter()` for details.
docstring_summary: See `Dataset.filter()` for details.
docstring_tokens: See Dataset . filter () for details .
function: def __init__(self, input_dataset, predicate):
      """See `Dataset.filter()` for details."""
      super(FilterDataset, self).__init__()
      self._input_dataset = input_dataset
  
      @function.Defun(*nest.flatten(input_dataset.output_types))
      def tf_predicate(*args):
        """A wrapper for Defun that facilitates shape inference."""
        # Pass in shape information from the input_dataset.
        for arg, shape in zip(args, nest.flatten(input_dataset.output_shapes)):
          arg.set_shape(shape)
  
        nested_args = nest.pack_sequence_as(input_dataset.output_types, args)
  
        if _should_unpack_args(nested_args):
          ret = predicate(*nested_args)
        else:
          ret = predicate(nested_args)
  
        ret = ops.convert_to_tensor(ret, dtype=dtypes.bool)
        if not (ret.dtype == dtypes.bool and
                ret.shape.is_compatible_with(tensor_shape.scalar())):
          raise ValueError("`predicate` must return a scalar boolean tensor.")
  
        return ret
  
      self._predicate = tf_predicate
      self._predicate.add_to_graph(ops.get_default_graph())
function_tokens: def __init__ ( self , input_dataset , predicate ) : super ( FilterDataset , self ) . __init__ ( ) self . _input_dataset = input_dataset @ function . Defun ( * nest . flatten ( input_dataset . output_types ) ) def tf_predicate ( * args ) : """A wrapper for Defun that facilitates shape inference.""" # Pass in shape information from the input_dataset. for arg , shape in zip ( args , nest . flatten ( input_dataset . output_shapes ) ) : arg . set_shape ( shape ) nested_args = nest . pack_sequence_as ( input_dataset . output_types , args ) if _should_unpack_args ( nested_args ) : ret = predicate ( * nested_args ) else : ret = predicate ( nested_args ) ret = ops . convert_to_tensor ( ret , dtype = dtypes . bool ) if not ( ret . dtype == dtypes . bool and ret . shape . is_compatible_with ( tensor_shape . scalar ( ) ) ) : raise ValueError ( "`predicate` must return a scalar boolean tensor." ) return ret self . _predicate = tf_predicate self . _predicate . add_to_graph ( ops . get_default_graph ( ) )