Skip to content

Commit

Permalink
better name
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitgr7 committed Apr 13, 2022
1 parent 5392d63 commit e075bc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from copy import deepcopy
from datetime import timedelta
from pathlib import Path
from typing import Any, Callable, cast, Dict, Generator, Iterable, List, Optional, Tuple, Type, Union
from typing import Any, Callable, cast, Dict, Generator, Iterable, List, Optional, Type, Union
from weakref import proxy

import torch
Expand Down Expand Up @@ -2780,12 +2780,12 @@ def configure_optimizers(self):

@contextmanager
def _evaluation_context() -> Generator:
cm = (
context_manager_class = (
torch.inference_mode
if _TORCH_GREATER_EQUAL_1_9 and not (dist.is_initialized() and dist.get_backend() == "gloo")
else torch.no_grad
)
with cm():
with context_manager_class():
yield


Expand Down

0 comments on commit e075bc2

Please sign in to comment.