pytorch/docs/source
Ke Wen 775a22c7c6 Add all_gather_into_tensor in place of _all_gather_base (#85686)
### Description
- This PR renames `_all_gather_base` to `all_gather_into_tensor` so that it is clearer in meaning.
- The `all_gather_into_tensor` API differs from the `all_gather` API in the output it accepts -- a single, large tensor instead of a list of tensors.
- This PR also adds deprecation warning to `_all_gather_base`.

### Issue
`_all_gather_base` was implemented in https://github.com/pytorch/pytorch/pull/33924 to avoid unnecessary flattening. There was previous effort (#82639) to merge `_all_gather_base` with the existing `all_gather` API by detecting the parameter type passed in for the output.

There are, however, two "blockers" that make the merge difficult:
(i) The merge leads to backward compatibility break. We would need to change the parameter name `tensor_list` in `all_gather` to a general name `output` that can cover both tensor and tensor list.
(ii) Recently, the `all_gather` API has added uneven tensor support, utilizing the tensor boundaries implied by the list. We are, however, not sure to add such support to the `_all_gather_base` function, because that would require users to pass in additional tensor boundary information.

In view of the above, we decided to productize `_all_gather_base` as a separate function, but with a clearer name.

### Testing
Added tests:
- `test_all_gather_into_cat_tensor_cuda` -- output form as with `torch.cat`. For example:
```
        >>> tensor_in
        tensor([1, 2], device='cuda:0') # Rank 0
        tensor([3, 4], device='cuda:1') # Rank 1
        >>> tensor_out
        tensor([1, 2, 3, 4], device='cuda:0') # Rank 0
        tensor([1, 2, 3, 4], device='cuda:1') # Rank 1
```
- `test_all_gather_into_stack_tensor_cuda` -- output form as with `torch.stack`. For example:
```
        >>> tensor_out2
        tensor([[1, 2],
                [3, 4]], device='cuda:0') # Rank 0
        tensor([[1, 2],
                [3, 4]], device='cuda:1') # Rank 1
```
The output form is determined by the shape of the output tensor passed by the user, no flag used.

Cc @rohan-varma @mrshenli @crcrpar @ptrblck @H-Huang
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85686
Approved by: https://github.com/rohan-varma, https://github.com/crcrpar
2022-09-27 22:50:22 +00:00
..
_static
_templates Fix left nav (#78552) 2022-06-01 00:49:53 +00:00
community Update PT maintainers list for AO (#85125) 2022-09-23 23:38:57 +00:00
elastic Add watchdog to TorchElastic agent and trainers (#84081) 2022-09-07 00:17:20 +00:00
notes [CUBLAS][TF32][CUDNN] Update numerical_accuracy.rst (#79537) 2022-09-07 18:30:26 +00:00
rpc
scripts [ONNX] Update ONNX documentation to include unsupported operators (#84496) 2022-09-16 23:48:37 +00:00
amp.rst Remove deprecated torch.matrix_rank (#70981) 2022-09-22 17:40:46 +00:00
autograd.rst Enable Intel® VTune™ Profiler's Instrumentation and Tracing Technology APIs (ITT) to PyTorch (#63289) 2022-07-13 13:50:15 +00:00
backends.rst Update backends.rst (#82525) 2022-08-03 18:33:15 +00:00
benchmark_utils.rst
bottleneck.rst Enable Intel® VTune™ Profiler's Instrumentation and Tracing Technology APIs (ITT) to PyTorch (#63289) 2022-07-13 13:50:15 +00:00
checkpoint.rst
complex_numbers.rst Add a note on CUDA 11.6 (#80363) 2022-06-27 21:34:24 +00:00
conf.py Add user facing documentation for CSAN (#84689) 2022-09-09 15:29:34 +00:00
config_mod.rst
cpp_extension.rst
cpp_index.rst
cuda._sanitizer.rst Rework printing tensor aliases in CSAN error message (#85008) 2022-09-21 13:41:52 +00:00
cuda.rst Add user facing documentation for CSAN (#84689) 2022-09-09 15:29:34 +00:00
cudnn_persistent_rnn.rst
cudnn_rnn_determinism.rst
data.rst [DataLoader] Minor documentation improvement 2022-05-31 15:59:46 +00:00
ddp_comm_hooks.rst Fix two small typos in ddp_comm_hooks.rst (#82047) 2022-07-23 19:10:57 +00:00
deploy.rst
distributed.algorithms.join.rst
distributed.elastic.rst
distributed.optim.rst
distributed.rst Add all_gather_into_tensor in place of _all_gather_base (#85686) 2022-09-27 22:50:22 +00:00
distributions.rst
dlpack.rst
docutils.conf
fft.rst
fsdp.rst
futures.rst
fx.rst CSE Pass and common pass Tests (#81742) 2022-07-22 03:45:09 +00:00
hub.rst
index.rst Add torch.nested namespace (#84102) 2022-09-12 16:31:05 +00:00
jit_builtin_functions.rst
jit_language_reference_v2.rst Fix typos in docs (#80602) 2022-08-29 23:32:44 +00:00
jit_language_reference.rst
jit_python_reference.rst
jit_unsupported.rst
jit_utils.rst Create __init__.py (#78629) 2022-06-03 18:14:21 +00:00
jit.rst torch.jit doc link for nvfuser readme.md (#77780) 2022-07-07 23:25:35 +00:00
library.rst Add docs for Python Registration 2022-06-13 23:21:23 +00:00
linalg.rst [Array API] Add linalg.vecdot (#70542) 2022-07-12 14:28:54 +00:00
masked.rst [maskedtensor] first commit, core and creation (#82836) 2022-08-16 20:10:34 +00:00
math-quantizer-equation.png
mobile_optimizer.rst
model_zoo.rst
monitor.rst
multiprocessing.rst
name_inference.rst
named_tensor.rst Add torch.unflatten and improve its docs (#81399) 2022-07-29 15:02:42 +00:00
nested.rst Add torch.nested namespace (#84102) 2022-09-12 16:31:05 +00:00
nn.functional.rst Add Dropout1d module 2022-06-15 14:39:07 +00:00
nn.init.rst update nn.init doc to reflect the no_grad (#80882) 2022-07-07 17:19:29 +00:00
nn.rst Add Dropout1d module 2022-06-15 14:39:07 +00:00
onnx_supported_aten_ops.rst [ONNX] Update ONNX documentation to include unsupported operators (#84496) 2022-09-16 23:48:37 +00:00
onnx.rst [ONNX] Reland #81953 Type utility for converting among JIT, torch and ONNX data types (#82995) 2022-08-08 23:43:43 +00:00
optim.rst feat: add PolynomialLR scheduler (#82769) 2022-08-10 18:21:00 +00:00
package.rst Fix typos in torch.package documentation (#82994) 2022-08-08 20:19:17 +00:00
pipeline.rst
profiler.rst
quantization-accuracy-debugging.rst quant docs: best practices for quantization accuracy debugging 2022-05-17 12:16:52 +00:00
quantization-backend-configuration.rst
quantization-support.rst Rename 'torch/ao/nn/quantized._reference' to 'torch/ao/nn/quantized/reference'. (#84974) 2022-09-16 17:49:07 +00:00
quantization.rst Rename 'torch/ao/nn/quantized._reference' to 'torch/ao/nn/quantized/reference'. (#84974) 2022-09-16 17:49:07 +00:00
random.rst
rpc.rst
sparse.rst Revise sparse docs regarding Sparse Compressed tensors (#82108) 2022-07-29 18:15:09 +00:00
special.rst torch.special.scaled_modified_bessel_k0 (#78900) 2022-06-29 14:53:37 +00:00
storage.rst Fix typos in docs (#80602) 2022-08-29 23:32:44 +00:00
tensor_attributes.rst
tensor_view.rst
tensorboard.rst
tensors.rst Remove deprecated torch.lstsq (#70980) 2022-09-23 00:16:55 +00:00
testing.rst Fix links in torch.testing docs (#80353) 2022-07-11 19:15:53 +00:00
torch.ao.ns._numeric_suite_fx.rst
torch.ao.ns._numeric_suite.rst
torch.overrides.rst Revert "Revert "Implement sym_sizes to create proper IR for sym ints representing tensor sizes (#76836)"" 2022-05-18 18:40:57 +00:00
torch.rst Remove deprecated torch.lstsq (#70980) 2022-09-23 00:16:55 +00:00
type_info.rst ENH: Convert finfo.tiny to finfo.smallest_normal (#76292) 2022-05-20 00:59:48 +00:00