import tensorflow as tf

#####################################################################################

# https://github.com/yaroslavvb/memory_util

import sys
import tensorflow as tf
import memory_util

memory_util.vlog(1)

sess = tf.Session()
with sess.as_default():
    tensor = tf.range(10)
    print_op = tf.print("tensors:", tensor, {'2': tensor * 2}, output_stream=sys.stderr)
    with tf.control_dependencies([print_op]):
        tripled_tensor = tensor * 3
        with memory_util.capture_stderr() as stderr:
            print(sess.run(tripled_tensor))
            print(stderr.getvalue())
