Skip to content

Commit ff7cc67

Browse files
authored
Change SupervisedTrainer decollation default.
Signed-off-by: Ivan <[email protected]>
1 parent cafc1fe commit ff7cc67

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

monai/engines/trainer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class SupervisedTrainer(Trainer):
120120
#ignite.engine.engine.Engine.register_events.
121121
decollate: whether to decollate the batch-first data to a list of data after model computation,
122122
recommend `decollate=True` when `postprocessing` uses components from `monai.transforms`.
123-
default to `True`.
123+
default to `False` as training slows due to tensor movement to CPU for decollation when enabled.
124124
optim_set_to_none: when calling `optimizer.zero_grad()`, instead of setting to zero, set the grads to None.
125125
more details: https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html.
126126
to_kwargs: dict of other args for `prepare_batch` API when converting the input data, except for
@@ -154,7 +154,7 @@ def __init__(
154154
amp: bool = False,
155155
event_names: list[str | EventEnum | type[EventEnum]] | None = None,
156156
event_to_attr: dict | None = None,
157-
decollate: bool = True,
157+
decollate: bool = False,
158158
optim_set_to_none: bool = False,
159159
to_kwargs: dict | None = None,
160160
amp_kwargs: dict | None = None,

0 commit comments

Comments
 (0)