Skip to content

Commit 74b7f1f

Browse files
Natalia Gimelsheinfacebook-github-bot
authored andcommitted
relax size check in flatten_for_scatter_gather (#40573)
Summary: Pull Request resolved: #40573 Per title, to workaround apex sbn bug. Test Plan: Covered by existing tests Reviewed By: blefaudeux Differential Revision: D22236942 fbshipit-source-id: 4e195e35e3e1b309400be53614d5368f6c08801e
1 parent 461014d commit 74b7f1f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

torch/lib/c10d/ProcessGroupNCCL.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,9 @@ std::vector<at::Tensor> flatten_for_scatter_gather(
624624
}
625625

626626
for (const auto& t : tensor_lists[i]) {
627-
if (t.sizes() != other[i].sizes()) {
627+
if (t.numel() != other[i].numel()) {
628628
throw std::runtime_error(
629-
"All tensor operands to scatter/gather must have the same size");
630-
}
631-
if (t.strides() != other[i].strides()) {
632-
throw std::runtime_error(
633-
"All tensor operands to scatter/gather must have the same layout (strides)");
629+
"All tensor operands to scatter/gather must have the same number of elements");
634630
}
635631
}
636632
// Flatten the tensors (from all ranks) into a single big tensor.

0 commit comments

Comments
 (0)