forked from tensorflow/tensorflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
97 changed files
with
1,895 additions
and
1,196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ node_modules | |
*.pyc | ||
__pycache__ | ||
*.swp | ||
.vscode/ |
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
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
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
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
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,54 @@ | ||
# Description: | ||
# Contains `SessionRunHook`s for use with `MonitoredSession` and the | ||
# wrappers around it. | ||
|
||
licenses(["notice"]) # Apache 2.0 | ||
|
||
exports_files(["LICENSE"]) | ||
|
||
package(default_visibility = ["//tensorflow:__subpackages__"]) | ||
|
||
load("//tensorflow:tensorflow.bzl", "py_test") | ||
|
||
py_library( | ||
name = "hooks", | ||
srcs = [ | ||
"__init__.py", | ||
"python/training/__init__.py", | ||
"python/training/profiler_hook.py", | ||
], | ||
srcs_version = "PY2AND3", | ||
deps = [ | ||
"//tensorflow/contrib/framework:framework_py", | ||
"//tensorflow/python:framework", | ||
"//tensorflow/python:framework_for_generated_wrappers", | ||
"//tensorflow/python:state_ops", | ||
"//tensorflow/python:training", | ||
"//tensorflow/python:variables", | ||
], | ||
) | ||
|
||
py_test( | ||
name = "profiler_hook_test", | ||
size = "small", | ||
srcs = ["python/training/profiler_hook_test.py"], | ||
srcs_version = "PY2AND3", | ||
deps = [ | ||
":hooks", | ||
"//tensorflow/python:client_testlib", | ||
"//tensorflow/python:framework_for_generated_wrappers", | ||
"//tensorflow/python:framework_test_lib", | ||
"//tensorflow/python:platform_test", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = glob( | ||
["**/*"], | ||
exclude = [ | ||
"**/METADATA", | ||
"**/OWNERS", | ||
], | ||
), | ||
) |
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,30 @@ | ||
# TensorFlow Experimental SessionRunHooks | ||
|
||
These hooks complement those in tensorflow/python/training. They are instances | ||
of `SessionRunHook` and are to be used with helpers like `MonitoredSession` | ||
and `learn.Estimator` that wrap `tensorflow.Session`. | ||
|
||
The hooks are called between invocations of `Session.run()` to perform custom | ||
behaviour. | ||
|
||
For example the `ProfilerHook` periodically collects `RunMetadata` after | ||
`Session.run()` and saves profiling information that can be viewed in a | ||
neat timeline through a Chromium-based web browser (via | ||
[about:tracing](chrome://tracing)) or the standalone [Catapult](https://github.com/catapult-project/catapult/blob/master/tracing/README.md) tool. | ||
|
||
```python | ||
from tensorflow.contrib.hooks import ProfilerHook | ||
|
||
hooks = [ProfilerHook(save_secs=30, output_dir="profiling")] | ||
with SingularMonitoredSession(hooks=hooks) as sess: | ||
while not sess.should_stop(): | ||
sess.run(some_op) | ||
``` | ||
|
||
Or similarly with contrib.learn: | ||
|
||
```python | ||
hooks = [ProfilerHook(save_steps=10, output_dir="profiling")] | ||
estimator = learn.Estimator(...) | ||
estimator.fit(input_fn, monitors=hooks) | ||
``` |
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,32 @@ | ||
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""hooks: A module containing `SessionRunHook`s for use with `MonitoredSession`. | ||
@@ProfilerHook | ||
""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
# pylint: disable=wildcard-import | ||
from tensorflow.contrib.hooks.python.training import * | ||
# pylint: enable=wildcard-import | ||
|
||
from tensorflow.python.util.all_util import remove_undocumented | ||
|
||
_allowed_symbols = ['ProfilerHook'] | ||
|
||
remove_undocumented(__name__, _allowed_symbols) |
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,24 @@ | ||
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
|
||
"""Experimental `SessionRunHooks` for use with `MonitoredSession`.""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
# pylint: disable=wildcard-import | ||
from tensorflow.contrib.hooks.python.training import * | ||
# pylint: enable=wildcard-import |
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 @@ | ||
# Copyright 2017 The TensorFlow Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# ============================================================================== | ||
"""hooks: A module containing `SessionRunHook`s for use with `MonitoredSession`. | ||
""" | ||
|
||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
from tensorflow.contrib.hooks.python.training.profiler_hook import ProfilerHook |
Oops, something went wrong.