pytorch/torch/utils/tensorboard/__init__.py
Sacha bc0d8649a4 Fix missing dependency in torch.utils.tensorboard (#115598)
Fixes #114591

Version package was removed in this pull request: #114108 but is still used in `torch.utils.tensorboard` causing import errors. The fix removes the import and uses a simpler check.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/115598
Approved by: https://github.com/malfet
2023-12-20 21:11:52 +00:00

13 lines
434 B
Python

import tensorboard
from torch._vendor.packaging.version import Version
if not hasattr(tensorboard, "__version__") or Version(
tensorboard.__version__
) < Version("1.15"):
raise ImportError("TensorBoard logging requires TensorBoard version 1.15 or above")
del Version
del tensorboard
from .writer import FileWriter, SummaryWriter # noqa: F401
from tensorboard.summary.writer.record_writer import RecordWriter # noqa: F401