Skip to content

Commit 5b29097

Browse files
committed
update docs
1 parent d61f6fe commit 5b29097

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/source-fabric/advanced/distributed_communication.rst

+5
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ Full example:
236236
result = fabric.all_gather(data)
237237
print("Result of all-gather:", result) # tensor([ 0, 10, 20, 30])
238238
239+
.. warning::
240+
241+
For the special case where ``world_size`` is 1, no additional dimension is added to the tensor(s). This inconsistency
242+
is kept for backward compatibility and you may need to handle this special case in your code to make it agnostic.
243+
239244

240245
----
241246

src/lightning/fabric/fabric.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ def all_gather(
583583
584584
Return:
585585
A tensor of shape (world_size, batch, ...), or if the input was a collection
586-
the output will also be a collection with tensors of this shape.
586+
the output will also be a collection with tensors of this shape. For the special case where
587+
world_size is 1, no additional dimension is added to the tensor(s).
587588
588589
"""
589590
self._validate_launched()

0 commit comments

Comments
 (0)