1# Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15"""Tests for profiler_wrapper.cc pybind methods.""" 16 17from tensorflow.python.eager import test 18from tensorflow.python.framework import test_util 19from tensorflow.python.profiler.internal import _pywrap_profiler as profiler_wrapper 20 21 22class ProfilerSessionTest(test_util.TensorFlowTestCase): 23 24 def test_xspace_to_tools_data_default_options(self): 25 # filenames only used for `tf_data_bottleneck_analysis` and 26 # `hlo_proto` tools. 27 profiler_wrapper.xspace_to_tools_data([], 'trace_viewer') 28 29 def _test_xspace_to_tools_data_options(self, options): 30 profiler_wrapper.xspace_to_tools_data([], 'trace_viewer', options) 31 32 def test_xspace_to_tools_data_empty_options(self): 33 self._test_xspace_to_tools_data_options({}) 34 35 def test_xspace_to_tools_data_int_options(self): 36 self._test_xspace_to_tools_data_options({'example_option': 0}) 37 38 def test_xspace_to_tools_data_str_options(self): 39 self._test_xspace_to_tools_data_options({'example_option': 'example'}) 40 41if __name__ == '__main__': 42 test.main() 43