Skip to content

Commit 472588a

Browse files
committed
fix
1 parent 2c60b9f commit 472588a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lightning/fabric/utilities/distributed.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def _sync_ddp(result: Tensor, group: Optional[Any] = None, reduce_op: Optional[U
119119
The reduced value.
120120
"""
121121
divide_by_world_size = False
122-
reduce_op = "avg" if reduce_op == "mean" else reduce_op
123122
group = torch.distributed.group.WORLD if group is None else group
124123

125124
op: Optional[ReduceOp]
126125
if isinstance(reduce_op, str):
126+
reduce_op = "avg" if reduce_op == "mean" else reduce_op
127127
if reduce_op.lower() == "avg" and torch.distributed.get_backend(group) == "gloo":
128128
# The GLOO backend does not support the `ReduceOp.AVG` operation
129129
op = ReduceOp.SUM # type: ignore[assignment]

0 commit comments

Comments
 (0)