aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/tfprof
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-07-06 19:07:18 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-07-06 19:10:31 -0700
commit154df32a959df74b3a1c377ff72f955d755b3d34 (patch)
tree53be9964b971a2efee8a665a1070a6b54c199716 /tensorflow/contrib/tfprof
parent5ff65ca53d37bf7fbc25e559a3b164796e9e7d05 (diff)
Follow up changes of tfprof migration:
1. Add a option_builder module to build options for Python API. 2. Expose necessary profiler protos. 3. Rename command line tool from tfprof to profiler. PiperOrigin-RevId: 161160274
Diffstat (limited to 'tensorflow/contrib/tfprof')
-rw-r--r--tensorflow/contrib/tfprof/model_analyzer.py69
-rw-r--r--tensorflow/contrib/tfprof/tfprof_logger.py4
2 files changed, 68 insertions, 5 deletions
diff --git a/tensorflow/contrib/tfprof/model_analyzer.py b/tensorflow/contrib/tfprof/model_analyzer.py
index 04b5063218..a7b609a031 100644
--- a/tensorflow/contrib/tfprof/model_analyzer.py
+++ b/tensorflow/contrib/tfprof/model_analyzer.py
@@ -23,17 +23,80 @@ from __future__ import print_function
# Import the names here for existing users.
# pylint: disable=unused-import
+from tensorflow.python.profiler import tfprof_logger
from tensorflow.python.profiler.model_analyzer import advise as _advise
from tensorflow.python.profiler.model_analyzer import ALL_ADVICE
-from tensorflow.python.profiler.model_analyzer import FLOAT_OPS_OPTIONS
-from tensorflow.python.profiler.model_analyzer import PRINT_ALL_TIMING_MEMORY
from tensorflow.python.profiler.model_analyzer import profile as _profile
from tensorflow.python.profiler.model_analyzer import Profiler
-from tensorflow.python.profiler.model_analyzer import TRAINABLE_VARS_PARAMS_STAT_OPTIONS
_DEFAULT_PROFILE_OPTIONS = 0
_DEFAULT_ADVISE_OPTIONS = 0
+# pylint: disable=bad-whitespace
+# pylint: disable=bad-continuation
+# options examples for profiling API.
+#
+# Show the parameter statistics of trainable variables.
+TRAINABLE_VARS_PARAMS_STAT_OPTIONS = {
+ 'max_depth': 10000,
+ 'min_bytes': 0,
+ 'min_micros': 0,
+ 'min_params': 0,
+ 'min_float_ops': 0,
+ 'order_by': 'name',
+ 'account_type_regexes': [tfprof_logger.TRAINABLE_VARIABLES],
+ 'start_name_regexes': ['.*'],
+ 'trim_name_regexes': [],
+ 'show_name_regexes': ['.*'],
+ 'hide_name_regexes': [],
+ 'account_displayed_op_only': True,
+ 'select': ['params'],
+ 'output': 'stdout',
+ 'dump_to_file': '' # Deprecated, use 'output': 'file:outfile=<name>'
+}
+
+# Show the number float operations.
+FLOAT_OPS_OPTIONS = {
+ 'max_depth': 10000,
+ 'min_bytes': 0,
+ 'min_micros': 0,
+ 'min_params': 0,
+ 'min_float_ops': 1,
+ 'order_by': 'float_ops',
+ 'account_type_regexes': ['.*'],
+ 'start_name_regexes': ['.*'],
+ 'trim_name_regexes': [],
+ 'show_name_regexes': ['.*'],
+ 'hide_name_regexes': [],
+ 'account_displayed_op_only': True,
+ 'select': ['float_ops'],
+ 'output': 'stdout',
+ 'dump_to_file': '' # Deprecated, use 'output': 'file:outfile=<name>'
+}
+
+
+# Show the timing stats and memory demands.
+PRINT_ALL_TIMING_MEMORY = {
+ 'max_depth': 10000,
+ 'min_bytes': 1, # Only >=1
+ 'min_micros': 1, # Only >=1
+ 'min_params': 0,
+ 'min_float_ops': 0,
+ 'order_by': 'name',
+ 'account_type_regexes': ['.*'],
+ 'start_name_regexes': ['.*'],
+ 'trim_name_regexes': [],
+ 'show_name_regexes': ['.*'],
+ 'hide_name_regexes': [],
+ 'account_displayed_op_only': True,
+ 'select': ['micros', 'bytes'],
+ 'output': 'stdout',
+ 'dump_to_file': '' # Deprecated, use 'output': 'file:outfile=<name>'
+}
+
+# pylint: enable=bad-whitespace
+# pylint: enable=bad-continuation
+
def advise(graph, run_meta=None, tfprof_options=_DEFAULT_ADVISE_OPTIONS):
return _advise(graph, run_meta, tfprof_options)
diff --git a/tensorflow/contrib/tfprof/tfprof_logger.py b/tensorflow/contrib/tfprof/tfprof_logger.py
index 9588bd2985..321ac5ad9f 100644
--- a/tensorflow/contrib/tfprof/tfprof_logger.py
+++ b/tensorflow/contrib/tfprof/tfprof_logger.py
@@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
-"""Logging tensorflow::tfprof::OpLog.
+"""Logging tensorflow::tfprof::OpLogProto.
-OpLog is used to add extra model information for offline analysis by tfprof.
+OpLogProto is used to add extra model information for offline analysis.
"""
from __future__ import absolute_import
from __future__ import division