-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: TorchWriter.reset() closes SummaryWriter (#5375)
next write will reopen the writers automatically so the net effect of the change is that new files are created for the first write after each reset.
- Loading branch information
1 parent
f9d8cfe
commit 282ddc0
Showing
2 changed files
with
24 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pathlib | ||
from typing import Any, Dict | ||
|
||
from _pytest import monkeypatch | ||
|
||
from determined import tensorboard | ||
from determined.tensorboard.metric_writers import pytorch | ||
|
||
|
||
def test_torch_writer(monkeypatch: monkeypatch.MonkeyPatch, tmp_path: pathlib.Path) -> None: | ||
def mock_get_base_path(dummy: Dict[str, Any]) -> pathlib.Path: | ||
return tmp_path | ||
|
||
monkeypatch.setattr(tensorboard, "get_base_path", mock_get_base_path) | ||
logger = pytorch.TorchWriter() | ||
logger.add_scalar("foo", 7, 0) | ||
logger.reset() | ||
logger.add_scalar("foo", 8, 1) | ||
logger.reset() | ||
|
||
files = list(tmp_path.iterdir()) | ||
assert len(files) == 2 |