Exemplo n.º 1
0
 def write_videos(self, observation, step=None, n=4):
     video = torch.clamp(observation[:, :n] + 0.5, 0., 1.).transpose(1, 0)
     writer: SummaryWriter = logger.get_tf_summary_writer()
     writer.add_video(tag='videos/ground_truth',
                      vid_tensor=video,
                      global_step=step,
                      fps=20)
Exemplo n.º 2
0
def log_hparams(params):
    writer = logger.get_tf_summary_writer()
    params = flatten_dict(params)
    filtered_params = dict()
    for key, value in params.items():
        if type(value) in [int, float, str, bool]:  # , torch.Tensor]:
            filtered_params[key] = value
    hparam_dict = filtered_params
    metric_dict = {'Return/Average': float('nan')}
    exp, ssi, sei = hparams(hparam_dict, metric_dict)
    writer.file_writer.add_summary(exp)
    writer.file_writer.add_summary(ssi)
    writer.file_writer.add_summary(sei)
    for k, v in metric_dict.items():
        writer.add_scalar(k, v)
Exemplo n.º 3
0
def video_summary(tag, video, step=None, fps=0.5):
    writer: SummaryWriter = logger.get_tf_summary_writer()
    writer.add_video(tag=tag, vid_tensor=video, global_step=step, fps=fps)