-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Added support for pathlib paths as a logdir using the recommended os.PathLike class. #5905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mspils
wants to merge
6
commits into
tensorflow:master
Choose a base branch
from
mspils:paths-hp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
87f883f
Added support for pathlib paths as a logdir using the recommended os.…
mspils 814037e
added test for pathlib.Path
mspils 331b6d2
remove empty line, fsdecode -> fspath
mspils 9ea743a
Update tensorboard/plugins/hparams/_keras.py
mspils 72ba0bf
Update tensorboard/plugins/hparams/_keras.py
mspils c11c94a
Changed test for error message invalid writer
mspils File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||
---|---|---|---|---|---|---|
|
@@ -15,6 +15,7 @@ | |||||
|
||||||
|
||||||
import os | ||||||
from pathlib import Path | ||||||
from unittest import mock | ||||||
|
||||||
from google.protobuf import text_format | ||||||
|
@@ -145,6 +146,14 @@ def test_explicit_writer(self): | |||||
# We'll assume that the contents are correct, as in the case where | ||||||
# the file writer was constructed implicitly. | ||||||
|
||||||
def test_pathlib_writer(self): | ||||||
writer = Path(self.logdir) | ||||||
self._initialize_model(writer=writer) | ||||||
self.model.fit(x=[(1,)], y=[(2,)], callbacks=[self.callback]) | ||||||
|
||||||
files = os.listdir(self.logdir) | ||||||
self.assertEqual(len(files), 1, files) | ||||||
|
||||||
def test_non_eager_failure(self): | ||||||
with tf.compat.v1.Graph().as_default(): | ||||||
assert not tf.executing_eagerly() | ||||||
|
@@ -165,7 +174,7 @@ def test_reuse_failure(self): | |||||
def test_invalid_writer(self): | ||||||
with self.assertRaisesRegex( | ||||||
TypeError, | ||||||
"writer must be a `SummaryWriter` or `str`, not None", | ||||||
"writer must be a `SummaryWriter`, `str` or `PathLike`, not None", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above
Suggested change
|
||||||
): | ||||||
_keras.Callback(writer=None, hparams={}) | ||||||
|
||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nitpick here but it would be nice to keep the formatting consistent