コード例 #1
0
ファイル: test_profile.py プロジェクト: zhaohb/cupy
 def test_profile(self):
     start_patch = mock.patch('cupy.cuda.profiler.start')
     stop_patch = mock.patch('cupy.cuda.profiler.stop')
     with start_patch as start, stop_patch as stop:
         with cuda.profile():
             pass
         start.assert_called_once_with()
         stop.assert_called_once_with()
コード例 #2
0
ファイル: test_profile.py プロジェクト: 2php/chainer
 def test_profile(self):
     start_patch = mock.patch('cupy.cuda.profiler.start')
     stop_patch = mock.patch('cupy.cuda.profiler.stop')
     with start_patch as start, stop_patch as stop:
         with cuda.profile():
             pass
         start.assert_called_once_with()
         stop.assert_called_once_with()
コード例 #3
0
ファイル: test_profile.py プロジェクト: zhaohb/cupy
 def test_err_case(self):
     start_patch = mock.patch('cupy.cuda.profiler.start')
     stop_patch = mock.patch('cupy.cuda.profiler.stop')
     with start_patch as start, stop_patch as stop:
         try:
             with cuda.profile():
                 raise Exception()
         except Exception:
             # ignore
             pass
         start.assert_called_once_with()
         stop.assert_called_once_with()
コード例 #4
0
ファイル: test_profile.py プロジェクト: 2php/chainer
 def test_err_case(self):
     start_patch = mock.patch('cupy.cuda.profiler.start')
     stop_patch = mock.patch('cupy.cuda.profiler.stop')
     with start_patch as start, stop_patch as stop:
         try:
             with cuda.profile():
                 raise Exception()
         except Exception:
             # ignore
             pass
         start.assert_called_once_with()
         stop.assert_called_once_with()