instructions for tensorboard (#61)
This commit is contained in:
committed by
Peter Zhokhov
parent
2507d335f9
commit
e5de29a954
@@ -398,6 +398,20 @@ def _squeeze_shape(shape):
|
|||||||
# ================================================================
|
# ================================================================
|
||||||
|
|
||||||
def launch_tensorboard_in_background(log_dir):
|
def launch_tensorboard_in_background(log_dir):
|
||||||
import subprocess
|
'''
|
||||||
print(log_dir)
|
To log the Tensorflow graph when using rl-algs
|
||||||
p = subprocess.Popen(['tensorboard', '--logdir', log_dir])
|
algorithms, you can run the following code
|
||||||
|
in your main script:
|
||||||
|
import threading, time
|
||||||
|
def start_tensorboard(session):
|
||||||
|
time.sleep(10) # Wait until graph is setup
|
||||||
|
tb_path = osp.join(logger.get_dir(), 'tb')
|
||||||
|
summary_writer = tf.summary.FileWriter(tb_path, graph=session.graph)
|
||||||
|
summary_op = tf.summary.merge_all()
|
||||||
|
launch_tensorboard_in_background(tb_path)
|
||||||
|
session = tf.get_default_session()
|
||||||
|
t = threading.Thread(target=start_tensorboard, args=([session]))
|
||||||
|
t.start()
|
||||||
|
'''
|
||||||
|
import subprocess
|
||||||
|
subprocess.Popen(['tensorboard', '--logdir', log_dir])
|
||||||
|
Reference in New Issue
Block a user