(self, input_pattern, shuffle_files)
return dataset, self.num_examples
Build dataset.

    Args:
      input_pattern: input file pattern.
      shuffle_files: whether to shuffle files list.

    Returns:
      Tuple of (tf.data.Dataset, number_of_examples)
Build dataset.
Build dataset .
def build(self, input_pattern, shuffle_files):
    """Build dataset.

    Args:
      input_pattern: input file pattern.
      shuffle_files: whether to shuffle files list.

    Returns:
      Tuple of (tf.data.Dataset, number_of_examples)
    """
    filenames = sorted(tf.gfile.Glob(input_pattern))
    if not filenames:
      raise ValueError("Can't not find files with pattern: %s." % input_pattern)
    dataset = tf.data.Dataset.from_tensor_slices(filenames)
    if shuffle_files:
      dataset = dataset.shuffle(len(filenames))
    options = tf.data.Options()
    options.experimental_deterministic = not shuffle_files
    dataset = dataset.with_options(options)
    dataset = dataset.interleave(
        self.reader_fn, num_parallel_calls=tf.data.experimental.AUTOTUNE)
    dataset = dataset.map(
        self.parser_fn, num_parallel_calls=tf.data.experimental.AUTOTUNE)
    return dataset, self.num_examples
def build ( self , input_pattern , shuffle_files ) : filenames = sorted ( tf . gfile . Glob ( input_pattern ) ) if not filenames : raise ValueError ( "Can't not find files with pattern: %s." % input_pattern ) dataset = tf . data . Dataset . from_tensor_slices ( filenames ) if shuffle_files : dataset = dataset . shuffle ( len ( filenames ) ) options = tf . data . Options ( ) options . experimental_deterministic = not shuffle_files dataset = dataset . with_options ( options ) dataset = dataset . interleave ( self . reader_fn , num_parallel_calls = tf . data . experimental . AUTOTUNE ) dataset = dataset . map ( self . parser_fn , num_parallel_calls = tf . data . experimental . AUTOTUNE ) return dataset , self . num_examples