Skip to content

Commit 35385df

Browse files
committed
remove turning off autograd by default for torch backend
this used to be required for truly backend-agnostic code in previous keras versions, but seems to be safe to omit now
1 parent bc7b750 commit 35385df

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

bayesflow/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ def setup():
3232

3333
from bayesflow.utils import logging
3434

35-
if keras.backend.backend() == "torch":
36-
# turn off gradients by default
37-
import torch
38-
39-
torch.autograd.set_grad_enabled(False)
40-
41-
logging.warning("Disabling gradients by default. Use\nwith torch.enable_grad():\nin custom training loops.")
42-
4335
logging.debug(f"Using backend {keras.backend.backend()!r}")
4436

4537

0 commit comments

Comments
 (0)