def __init__(self, datasets): DataIteratorBase.__init__(self, datasets) self._variable_scope = get_unique_named_variable_scope('data_iterator') with tf.variable_scope(self._variable_scope): arb_dataset = self._datasets[next(iter(self._datasets))] self._iterator = tf.data.Iterator.from_structure( arb_dataset.output_types, arb_dataset.output_shapes) self._iterator_init_ops = { name: self._iterator.make_initializer(d) for name, d in self._datasets.items() }
def __init__(self, datasets): DataIteratorBase.__init__(self, datasets) self._variable_scope = get_unique_named_variable_scope( 'feedable_data_iterator') with tf.variable_scope(self._variable_scope): self._handle = tf.placeholder(tf.string, shape=[], name='handle') arb_dataset = self._datasets[next(iter(self._datasets))] self._iterator = tf.data.Iterator.from_string_handle( self._handle, arb_dataset.output_types, arb_dataset.output_shapes) self._dataset_iterators = { name: dataset.make_initializable_iterator() for name, dataset in self._datasets.items() }
def __init__(self, hparams=None): self._hparams = HParams(hparams, self.default_hparams()) name = self._hparams.name self._variable_scope = get_unique_named_variable_scope(name) self._unique_name = self._variable_scope.name.split("/")[-1]