I cant run the tensorflow dataset window examples in graph mode. This
def test_window_graph_mode():
tf.reset_default_graph()
dataset = tf.data.Dataset.range(7).window(3, 2, 1, True)
iterator = dataset.make_one_shot_iterator()
next_element = iterator.get_next()
with tf.Session() as sess:
print(sess.run(next_element))
crashes - while this
def test_window_graph_mode():
tf.reset_default_graph()
dataset = tf.data.Dataset.range(7)
iterator = dataset.make_one_shot_iterator()
next_element = iterator.get_next()
with tf.Session() as sess:
print(sess.run(next_element))
works fine. The error is
TypeError: Fetch argument <_VariantDataset shapes: (), types: tf.int64> has invalid type <class 'tensorflow.python.data.ops.dataset_ops._VariantDataset'>, must be a string or Tensor. (Can not convert a _VariantDataset into a Tensor or Operation.)
The examples dont demonstrate the user of make_one_shot_iterator and get_next -- I picked that up from google searches. Is there some other interface to using Window in old style graph mode tensorflow?