Revert "[Easy] Add more check for elapsedTime of torch.xxx.Event and torch.Event (#151404)"

This reverts commit 783be8f93248ca3af24b968bdf84188f5a3257d1.

Reverted https://github.com/pytorch/pytorch/pull/151404 on behalf of https://github.com/malfet due to suspected of breaking linux builds and breaks internal tests as well ([comment](https://github.com/pytorch/pytorch/pull/151404#issuecomment-2819041756))
This commit is contained in:
PyTorch MergeBot
2025-04-21 17:11:53 +00:00
parent 33808f0ebd
commit 9374064483
5 changed files with 10 additions and 68 deletions

View File

@ -960,22 +960,6 @@ class TestCuda(TestCase):
self.assertTrue(event.query())
self.assertGreater(start_event.elapsed_time(event), 0)
def test_events_elapsedtime(self):
event1 = torch.cuda.Event(enable_timing=False)
event2 = torch.cuda.Event(enable_timing=False)
with self.assertRaisesRegex(
ValueError, "Both events must be recorded before calculating elapsed time"
):
event1.elapsed_time(event2)
event1.record()
event2.record()
with self.assertRaisesRegex(
ValueError,
"Both events must be created with argument 'enable_timing=True'",
):
event1.elapsed_time(event2)
def test_generic_stream_event(self):
stream = torch.Stream("cuda")
self.assertEqual(stream.device_index, torch.cuda.current_device())