From 9625693bff6ed4236f1f92976929b0fd250420cf Mon Sep 17 00:00:00 2001 From: Tzu-Wei Huang Date: Wed, 8 Apr 2026 16:21:28 +0800 Subject: [PATCH 1/2] Trigger CI and coverage tests on all pushes and pull requests --- .github/workflows/test-matrix.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index e910f74..18339f0 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -3,11 +3,7 @@ name: Python application -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: From a4f194312505f4fc44c564576e4c310dd62220b3 Mon Sep 17 00:00:00 2001 From: Tzu-Wei Huang Date: Wed, 8 Apr 2026 16:34:53 +0800 Subject: [PATCH 2/2] Remove obsolete TorchVis class and torchvis.py --- docs/tensorboard.rst | 5 ----- tensorboardX/__init__.py | 1 - tensorboardX/torchvis.py | 47 ---------------------------------------- 3 files changed, 53 deletions(-) delete mode 100644 tensorboardX/torchvis.py diff --git a/docs/tensorboard.rst b/docs/tensorboard.rst index 99f03ea..75e8377 100644 --- a/docs/tensorboard.rst +++ b/docs/tensorboard.rst @@ -11,8 +11,3 @@ tensorboardX :members: .. automethod:: __init__ - -.. autoclass:: TorchVis - :members: - - .. automethod:: __init__ \ No newline at end of file diff --git a/tensorboardX/__init__.py b/tensorboardX/__init__.py index 5181247..4244d39 100644 --- a/tensorboardX/__init__.py +++ b/tensorboardX/__init__.py @@ -3,7 +3,6 @@ from .global_writer import GlobalSummaryWriter from .record_writer import RecordWriter -from .torchvis import TorchVis from .writer import FileWriter, SummaryWriter try: diff --git a/tensorboardX/torchvis.py b/tensorboardX/torchvis.py deleted file mode 100644 index 735abfe..0000000 --- a/tensorboardX/torchvis.py +++ /dev/null @@ -1,47 +0,0 @@ -import gc - -from .writer import SummaryWriter - -# Supports TensorBoard visualization -vis_formats = {'tensorboard': SummaryWriter} - - -class TorchVis: - def __init__(self, *args, **init_kwargs): - """ - Args: - args (list of strings): The name of the visualization target(s). - Accepted targets are 'tensorboard'. - init_kwargs: Additional keyword parameters for the writer. - """ - self.subscribers = {} - self.register(*args, **init_kwargs) - - def register(self, *args, **init_kwargs): - # Sets tensorboard as the default visualization format if not specified - formats = args if args else ['tensorboard'] - for format in formats: - if self.subscribers.get(format) is None and format in vis_formats: - self.subscribers[format] = vis_formats[format](**init_kwargs.get(format, {})) - - def unregister(self, *args): - for format in args: - if format in self.subscribers: - self.subscribers[format].close() - del self.subscribers[format] - gc.collect() - - def __getattr__(self, attr): - if not self.subscribers: - raise AttributeError(f"'{type(self).__name__}' object has no attribute '{attr}'") - - def wrapper(*args, **kwargs): - for _, subscriber in self.subscribers.items(): - if hasattr(subscriber, attr): - getattr(subscriber, attr)(*args, **kwargs) - return wrapper - - # Handle writer management (open/close) for the user - def __del__(self): - for _, subscriber in self.subscribers.items(): - subscriber.close()