From 3365d129dccb9525d40dfd7159d97ced54ff1f8e Mon Sep 17 00:00:00 2001 From: Mick van Gelderen Date: Tue, 3 Dec 2024 17:07:09 -0800 Subject: [PATCH] Add no-op writer --- .../metric_writers/noop_writer.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/jax_loop_utils/metric_writers/noop_writer.py diff --git a/src/jax_loop_utils/metric_writers/noop_writer.py b/src/jax_loop_utils/metric_writers/noop_writer.py new file mode 100644 index 0000000..210910a --- /dev/null +++ b/src/jax_loop_utils/metric_writers/noop_writer.py @@ -0,0 +1,60 @@ +"""No-op MetricWriter implementation.""" + +from collections.abc import Mapping +from typing import Any, Optional + +from jax_loop_utils.metric_writers.interface import Array, MetricWriter, Scalar + + +class NoOpWriter(MetricWriter): + """MetricWriter that performs no operations.""" + + def write_summaries( + self, + step: int, + values: Mapping[str, Array], + metadata: Optional[Mapping[str, Any]] = None, + ): + pass + + def write_scalars(self, step: int, scalars: Mapping[str, Scalar]): + pass + + def write_images(self, step: int, images: Mapping[str, Array]): + pass + + def write_videos(self, step: int, videos: Mapping[str, Array]): + pass + + def write_audios(self, step: int, audios: Mapping[str, Array], *, sample_rate: int): + pass + + def write_texts(self, step: int, texts: Mapping[str, str]): + pass + + def write_histograms( + self, + step: int, + arrays: Mapping[str, Array], + num_buckets: Optional[Mapping[str, int]] = None, + ): + pass + + def write_pointcloud( + self, + step: int, + point_clouds: Mapping[str, Array], + *, + point_colors: Mapping[str, Array] | None = None, + configs: Mapping[str, str | float | bool | None] | None = None, + ): + pass + + def write_hparams(self, hparams: Mapping[str, Any]): + pass + + def flush(self): + pass + + def close(self): + pass