@@ -38,6 +38,12 @@ Create a message logging system for PyTorch with the following requirements:
38
38
- ** Prototype** : Emitted when a prototype feature is called. See
39
39
[ PyTorch feature classifications] ( https://pytorch.org/blog/pytorch-feature-classification-changes/ )
40
40
41
+ - TODO: Should all the classic Python errors and warnings (` TypeError ` ,
42
+ ` ValueError ` , ` NotImplementedError ` , ` DeprecationWarning ` , etc) have their
43
+ own message class? Or are those separate from our concept of a message
44
+ class, and any message class is allowed to raise any Python exception or
45
+ warning type?
46
+
41
47
* Continue using warning/error APIs that currently exist in PyTorch wherever
42
48
possible. For instance, ` TORCH_CHECK ` , ` TORCH_WARN ` , and ` TORCH_WARN_ONCE `
43
49
should continue to be used in C++
@@ -47,30 +53,41 @@ Create a message logging system for PyTorch with the following requirements:
47
53
48
54
* Creating new message classes and severity levels should be easy
49
55
50
- * Settings to turn warnings for a specific message class into errors
56
+ * Ability to turn warnings into errors. This is already possible with the
57
+ Python ` warnings ` module filter, but the PyTorch docs should mention it and
58
+ we should probably have unit tests for it.
59
+ See [ documentation] ( https://docs.python.org/3/library/warnings.html#the-warnings-filter )
51
60
52
61
* Settings to disable specific message classes and severity levels
53
62
54
- - TODO: However, most errors should not be disableable, right? Perhaps only
63
+ - TODO: Most errors should not be disableable, right? Perhaps only
55
64
some message classes should allow disabling or downgrading errors. For
56
65
instance, currently in PyTorch, we can downgrade a nondeterministic error
57
66
to a warning, but we wouldn't want to downgrade an error from invalid
58
67
arguments given to an operation.
59
68
69
+ - Disabling warnings in Python should already be possible with the ` warnings `
70
+ module filter. See [ documentation] ( https://docs.python.org/3/library/warnings.html#the-warnings-filter ) .
71
+ There is no similar system in C++ at the moment, and building one is probably
72
+ low priority.
73
+
74
+ - Filtering out ** Info** severity messages would also be nice to have, since
75
+ excessive printouts can degrade the user experience. Related to
76
+ issue [ #68768 ] ( https://github.com/pytorch/pytorch/issues/68768 )
77
+
60
78
* Settings to avoid emitting duplicate messages generated by multiple
61
- ` torch.distribted ` ranks (related to issue
62
- [ #68768 ] ( https://github.com/pytorch/pytorch/issues/68768 ) )
79
+ ` torch.distributed ` ranks. Related to issue
80
+ [ #68768 ] ( https://github.com/pytorch/pytorch/issues/68768 )
63
81
64
- * Ability to make a particular warning only warn once
82
+ * Ability to make a particular warning only warn once. Warn-once should be the
83
+ default in most cases.
65
84
66
85
- NOTE: Currently ` TORCH_WARN_ONCE ` does this in C++, but there is no Python
67
86
equivalent
68
87
69
- - TODO: Should there be a setting to turn a warn-always into a warn-once for
88
+ - TODO: Should there be a setting to turn a warn-once into a warn-once for
70
89
a given message class and vice versa?
71
90
72
- - TODO: Should warn-once be its own separate severity level?
73
-
74
91
* Settings can be changed from Python, C++, or environment variables
75
92
76
93
- Filtering warnings with Python command line arguments should
0 commit comments