monitor: add docstrings to pybind interface (#71481)

Summary:
This adds argument names and docstrings so the docs are a lot more understandable.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71481

Test Plan:
docs/tests CI should suffice

![Screenshot 2022-01-19 at 16-35-10 torch monitor — PyTorch master documentation](https://user-images.githubusercontent.com/909104/150240882-e69cfa17-e2be-4569-8ced-71979a89b369.png)

Reviewed By: edward-io

Differential Revision: D33661255

Pulled By: d4l3k

fbshipit-source-id: 686835dfe331b92a51f4409ec37f8ee6211e49d3
(cherry picked from commit 0a6accda1bec839bbc9387d80caa51194e81d828)
This commit is contained in:
Tristan Rice
2022-01-21 14:54:11 -08:00
committed by PyTorch MergeBot
parent 84fe4279db
commit 26d54b4076
3 changed files with 215 additions and 35 deletions

View File

@ -15,6 +15,7 @@ from torch.monitor import (
log_event,
register_event_handler,
unregister_event_handler,
Stat,
)
class TestMonitor(TestCase):
@ -30,6 +31,7 @@ class TestMonitor(TestCase):
(Aggregation.SUM, Aggregation.COUNT),
timedelta(milliseconds=1),
)
self.assertIsInstance(s, Stat)
self.assertEqual(s.name, "asdf")
s.add(2)
@ -49,6 +51,7 @@ class TestMonitor(TestCase):
(Aggregation.SUM, Aggregation.COUNT),
3,
)
self.assertIsInstance(s, Stat)
s.add(1)
s.add(2)
name = s.name