Skip to content

Commit 94bcd3a

Browse files
committed
refactor: NoClosureError
1 parent aa13de3 commit 94bcd3a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pytorch_optimizer/base/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self):
1919
super().__init__(self.message)
2020

2121

22-
class ClosureError(Exception):
22+
class NoClosureError(Exception):
2323
"""Raised when there's no closure function"""
2424

2525
def __init__(self, optimizer_name: str):

pytorch_optimizer/optimizer/sam.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from torch.optim.optimizer import Optimizer
55

66
from pytorch_optimizer.base.base_optimizer import BaseOptimizer
7-
from pytorch_optimizer.base.exception import ClosureError
7+
from pytorch_optimizer.base.exception import NoClosureError
88
from pytorch_optimizer.base.types import CLOSURE, DEFAULTS, OPTIMIZER, PARAMETERS
99

1010

@@ -124,7 +124,7 @@ def second_step(self, zero_grad: bool = False):
124124
@torch.no_grad()
125125
def step(self, closure: CLOSURE = None):
126126
if closure is None:
127-
raise ClosureError(self.__name__)
127+
raise NoClosureError(self.__name__)
128128

129129
self.first_step(zero_grad=True)
130130

0 commit comments

Comments
 (0)