Skip to content

Commit 2134216

Browse files
authored
Change WarningCache to subclass set (#7995)
1 parent 4ffba60 commit 2134216

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

pytorch_lightning/utilities/warnings.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@
1414
from pytorch_lightning.utilities.distributed import rank_zero_warn
1515

1616

17-
class WarningCache:
18-
19-
def __init__(self):
20-
self.warnings = set()
17+
class WarningCache(set):
2118

2219
def warn(self, m, *args, **kwargs):
23-
if m not in self.warnings:
24-
self.warnings.add(m)
20+
if m not in self:
21+
self.add(m)
2522
rank_zero_warn(m, *args, **kwargs)
26-
27-
def clear(self):
28-
self.warnings.clear()

0 commit comments

Comments
 (0)