Skip to content

Commit 1310f15

Browse files
authored
Merge branch 'master' into dependabot/github_actions/github-actions-e8e82a767a
2 parents 437fb8b + 8aa0679 commit 1310f15

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ignite/engine/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
from collections.abc import Callable, Mapping, Sequence
4-
from typing import TYPE_CHECKING, Any
4+
from typing import TYPE_CHECKING, Any, cast
55

66
if TYPE_CHECKING:
77
# GradScaler is imported here rather than used as a string literal ("torch.amp.GradScaler")
@@ -221,7 +221,7 @@ def update(engine: Engine, batch: Sequence[torch.Tensor]) -> Any | tuple[torch.T
221221
if gradient_accumulation_steps > 1:
222222
loss = loss / gradient_accumulation_steps
223223
if scaler:
224-
scaler.scale(loss).backward()
224+
cast(torch.Tensor, scaler.scale(loss)).backward()
225225
if engine.state.iteration % gradient_accumulation_steps == 0:
226226
scaler.step(optimizer)
227227
scaler.update()

ignite/handlers/polyaxon_logger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def __init__(self, *args: Any, **kwargs: Any):
122122
def close(self) -> None:
123123
try:
124124
self.experiment.end()
125-
except:
125+
except Exception:
126126
pass
127127

128128
def __getattr__(self, attr: Any) -> Any:

0 commit comments

Comments
 (0)