Skip to content

Commit 412773c

Browse files
committed
update: ClosureError
1 parent 24f6d38 commit 412773c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pytorch_optimizer/base/exception.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,17 @@ def __init__(self, optimizer_name: str, note: str = ''):
1111
super().__init__(self.message)
1212

1313

14-
class ZeroParameterSize(Exception):
14+
class ZeroParameterSizeError(Exception):
1515
"""Raised when the parameter size is 0"""
1616

1717
def __init__(self):
1818
self.message: str = '[-] parameter size is 0'
1919
super().__init__(self.message)
20+
21+
22+
class ClosureError(Exception):
23+
"""Raised when there's no closure function"""
24+
25+
def __init__(self, optimizer_name: str):
26+
self.message: str = f'[-] {optimizer_name} requires closure.'
27+
super().__init__(self.message)

0 commit comments

Comments
 (0)