bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
tensorboard_server.h
Go to the documentation of this file.
1#ifndef TENSORBOARD_SERVER_H
2#define TENSORBOARD_SERVER_H
3
6
7#include <boost/noncopyable.hpp>
8#include <string>
9#include <string_view>
10#include <unordered_map>
11
12namespace bitrl
13{
14namespace network
15{
16
20class TensorboardServer : private boost::noncopyable
21{
22 public:
26 TensorboardServer(const std::string &api_url);
27
31 void init(const std::string &log_dir);
32
36 void close();
37
41 void add_scalar(const std::string &tag, real_t value,
42 uint_t step_idx = bitsim::consts::INVALID_ID) const;
43
47 void add_scalars(const std::string &main_tag,
48 const std::unordered_map<std::string, real_t> &values,
49 uint_t step_idx = bitsim::consts::INVALID_ID) const;
50
54 void add_text(const std::string &tag, const std::string &text,
55 uint_t step_idx = bitsim::consts::INVALID_ID) const;
56
60 std::string_view get_log_dir_path() const noexcept { return log_dir_; }
61
65 std::string_view get_server_address() const noexcept { return api_url_; }
66
67 private:
68 std::string api_url_;
69 std::string log_dir_;
70
71 const std::string api_str_;
72};
73
74} // namespace network
75} // namespace bitrl
76#endif // TENSORBOARD_SERVER_H
void add_scalar(const std::string &tag, real_t value, uint_t step_idx=bitsim::consts::INVALID_ID) const
Add scalar.
void close()
Close the TensorboardServer.
TensorboardServer(const std::string &api_url)
Constructor.
std::string_view get_server_address() const noexcept
Return the server address.
Definition tensorboard_server.h:65
void add_text(const std::string &tag, const std::string &text, uint_t step_idx=bitsim::consts::INVALID_ID) const
Add scalar.
void add_scalars(const std::string &main_tag, const std::unordered_map< std::string, real_t > &values, uint_t step_idx=bitsim::consts::INVALID_ID) const
Add scalar.
void init(const std::string &log_dir)
Set the log_dir for this instance.
std::string_view get_log_dir_path() const noexcept
Return the directory for logging.
Definition tensorboard_server.h:60
Definition rest_rl_env_client.h:20
Various utilities used when working with RL problems.
Definition bitrl_log.h:25
const uint_t INVALID_ID
Invalid id.
Definition bitsim_consts.h:16
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20