#!/usr/bin/env python3

import tensorflow as tf

from garage.misc import logger

logger.set_tensorboard_dir("data/local/histogram_example")
N = 400
for i in range(N):
    sess = tf.Session()
    sess.__enter__()
    k_val = i / float(N)
    logger.record_histogram_by_type('gamma', key='gamma', alpha=k_val)
    logger.record_histogram_by_type('normal',
                                    key='normal',
                                    mean=5 * k_val,
                                    stddev=1.0)
    logger.record_histogram_by_type('poisson', key='poisson', lam=k_val)
    logger.record_histogram_by_type('uniform',
                                    key='uniform',
                                    maxval=k_val * 10)
    logger.record_tabular("app", k_val)
    logger.record_histogram("gass", k_val)
    logger.dump_tensorboard(step=i)
Пример #2
0
    e = GaussianMLPEmbedding(embed_spec, std_share_network=True)
    p = GaussianMLPMultitaskPolicy(env_spec=env_spec,
                                   task_space=task_space,
                                   embedding=e,
                                   std_share_network=True)

    my_task = task_space.new_tensor_variable(name="my_task", extra_dims=1)
    my_obs = obs_space.new_tensor_variable(name="my_obs", extra_dims=1)
    with tf.name_scope("build_opt"):
        dist_info = e.dist_info_sym(my_task, name="e_dist_info")
        p_dist_info = p.dist_info_sym(my_task, my_obs, name="p_dist_info")

    with tf.name_scope("test_fixture"):
        a = tf.exp(e.latent)
        b = tf.exp(e._latent_std_param)

    sess.run(tf.global_variables_initializer())

    t = task_space.sample()
    o = obs_space.sample()
    to = np.concatenate([t, o], axis=0)
    p.get_action(to)
    z = latent_space.sample()
    p.get_action_from_latent(z, o)

    logger.dump_tensorboard()
    ipdb.set_trace()

    print("done!")