pulsatrix
Loading...
Searching...
No Matches
implot_metrics_sink.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <string>
8#include <unordered_map>
9#include <vector>
10
12#include "pulsatrix/tensor.hpp"
13
14namespace pulsatrix {
15
18 std::vector<int> steps;
19 std::vector<double> values;
20};
21
37public:
38 void log_scalar(const std::string& tag, double value, int step) override;
39 void log_histogram(const std::string& tag, const Tensor& values, int step) override;
40
42 [[nodiscard]] const std::unordered_map<std::string, ScalarSeries>& scalar_series() const {
43 return scalar_series_;
44 }
45
48 [[nodiscard]] const std::unordered_map<std::string, std::vector<float>>& latest_histograms() const {
49 return latest_histograms_;
50 }
51
54 void Draw() const;
55
56private:
57 std::unordered_map<std::string, ScalarSeries> scalar_series_;
58 std::unordered_map<std::string, std::vector<float>> latest_histograms_;
59};
60
61} // namespace pulsatrix
A concrete MetricsSink (metrics_sink.hpp's own doc comment names this the expected extension point: "...
Definition implot_metrics_sink.hpp:36
const std::unordered_map< std::string, ScalarSeries > & scalar_series() const
Every scalar tag's full logged series so far.
Definition implot_metrics_sink.hpp:42
void Draw() const
Renders one line chart per scalar tag (small multiples) plus the latest histogram snapshot per tag....
void log_scalar(const std::string &tag, double value, int step) override
Logs a scalar value (e.g. loss, accuracy).
const std::unordered_map< std::string, std::vector< float > > & latest_histograms() const
Every histogram tag's most recently logged snapshot (not a running history – only the latest values p...
Definition implot_metrics_sink.hpp:48
void log_histogram(const std::string &tag, const Tensor &values, int step) override
Logs a distribution of values (e.g. a weight tensor's values).
Interface the training loop logs scalars/histograms through. Concrete writers (TensorBoard event form...
Definition metrics_sink.hpp:22
N-dimensional tensor. Owns its data buffer exclusively; a DeviceBackend* is injected (not owned) – th...
Definition tensor.hpp:29
Keeps monitoring/visualization tools out of the training core – same OCP/DIP pattern as DeviceBackend...
Definition acquisition_functions.hpp:16
One scalar tag's logged (step, value) pairs, in log order.
Definition implot_metrics_sink.hpp:17
std::vector< int > steps
Definition implot_metrics_sink.hpp:18
std::vector< double > values
Definition implot_metrics_sink.hpp:19
N-dimensional tensor – owns a buffer via DeviceBackend*, RAII (Rule of Five).