-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtensorboard_summaries.py
59 lines (49 loc) · 2.31 KB
/
tensorboard_summaries.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import tensorflow as tf
def build_tensorboard_summaries(var_list):
summary_vars = []
for var in var_list:
tf_var = tf.Variable(0.)
tf.summary.scalar(var, tf_var)
summary_vars.append(tf_var)
summary_ops = tf.summary.merge_all()
return summary_ops, summary_vars
def build_load_balance_tf_summaries():
action_loss = tf.Variable(0.)
tf.summary.scalar("Action loss", action_loss)
entropy = tf.Variable(0.)
tf.summary.scalar("Entropy", entropy)
value_loss = tf.Variable(0.)
tf.summary.scalar("Value loss", value_loss)
eps_length = tf.Variable(0.)
tf.summary.scalar("Episode length", eps_length)
average_reward = tf.Variable(0.)
tf.summary.scalar("Average number of concurrent jobs", average_reward)
sum_rewards = tf.Variable(0.)
tf.summary.scalar("Sum of rewards", sum_rewards)
eps_duration = tf.Variable(0.)
tf.summary.scalar("Episode duration in seconds", eps_duration)
entropy_weight = tf.Variable(0.)
tf.summary.scalar("Entropy weight", entropy_weight)
reset_prob = tf.Variable(0.)
tf.summary.scalar("Reset probability", reset_prob)
num_stream_jobs = tf.Variable(0.)
tf.summary.scalar("Number of stream jobs", num_stream_jobs)
reset_hit = tf.Variable(0.)
tf.summary.scalar("Fraction of reset hit", reset_hit)
eps_finished_jobs = tf.Variable(0.)
tf.summary.scalar("Number of finished jobs in an episode", eps_finished_jobs)
eps_unfinished_jobs = tf.Variable(0.)
tf.summary.scalar("Number of unfinished jobs", eps_unfinished_jobs)
eps_finished_work = tf.Variable(0.)
tf.summary.scalar("Number of finished total work in an episode", eps_finished_work)
eps_unfinished_work = tf.Variable(0.)
tf.summary.scalar("Number of unfinished work", eps_unfinished_work)
average_job_duration = tf.Variable(0.)
tf.summary.scalar("Average job duration", average_job_duration)
summary_vars = [action_loss, entropy, value_loss, eps_length, \
average_reward, sum_rewards, eps_duration, \
entropy_weight, reset_prob, num_stream_jobs, \
reset_hit, eps_finished_jobs, eps_unfinished_jobs, \
eps_finished_work, eps_unfinished_work, average_job_duration]
summary_ops = tf.summary.merge_all()
return summary_ops, summary_vars