[ create a new paste ] login | about

Link: http://codepad.org/uyjgY6TD    [ raw code | output | fork ]

Python, pasted on Jan 11:
    def _dataset_from_generator(self):
        """
        Create a `tf.data.Dataset` from a layer_op (as a generator).

        :return: a `tf.data.Dataset`
        """
        tf.logging.info('Initialising dataset from generator...')

        if self._num_threads < 2 or not self.shuffle:
            window_generator = self
        else:
            self._enqueuer = GeneratorEnqueuer(
                self(),
                use_multiprocessing=True,
                wait_time=0.01,
                seed=self._seed)
            self._enqueuer.start(
                workers=self._num_threads, max_queue_size=self.queue_length)
            window_generator = self._enqueuer.get

        # dataset from generator
        dataset = tf.data.Dataset.from_generator(
            generator=window_generator,
            output_types=self.tf_dtypes,
            output_shapes=self.tf_shapes)

        # dataset: slice the n-element window into n single windows
        dataset = dataset.flat_map(map_func=tf.data.Dataset.from_tensor_slices)
        return dataset


Output:
1
2
3
4
  Line 1
    def _dataset_from_generator(self):
    ^
IndentationError: unexpected indent


Create a new paste based on this one


Comments: