Skip to content

Commit 57a7392

Browse files
committed
improve warning message for torch backend
1 parent 86847f3 commit 57a7392

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bayesflow/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ def setup():
4040
torch.autograd.set_grad_enabled(False)
4141

4242
logging.warning(
43+
"\n"
4344
"When using torch backend, we need to disable autograd by default to avoid excessive memory usage. Use\n"
45+
"\n"
4446
"with torch.enable_grad():\n"
47+
" ...\n"
48+
"\n"
4549
"in contexts where you need gradients (e.g. custom training loops)."
4650
)
4751

0 commit comments

Comments
 (0)