Skip to content

Instantly share code, notes, and snippets.

@bzamecnik
Created October 28, 2017 14:52
Show Gist options
  • Save bzamecnik/44a3642c05afc2ac09135687edce8a9d to your computer and use it in GitHub Desktop.
Save bzamecnik/44a3642c05afc2ac09135687edce8a9d to your computer and use it in GitHub Desktop.
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.data_flow_ops import StagingArea
dataset_range = tf.contrib.data.Dataset.range(10)
iter = dataset_range.make_one_shot_iterator()
next_item = iter.get_next()
area = StagingArea(dtypes=[tf.int64])
area_put = area.put([next_item])
area_get = area.get()
with tf.Session() as sess:
print('put:', sess.run(area_put))
print('size:', sess.run(area.size()))
print('put(); get() =', sess.run(tf.group(area_put, area_get)))
print('size:', sess.run(area.size()))
# put: None
# size: 1
# put(); get() = None
# size: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment