From 4fb4aa3e70851a62b8ced8aa8ee89519f9d8d92e Mon Sep 17 00:00:00 2001 From: Diego Sandoval Date: Thu, 21 Nov 2024 20:13:39 +0000 Subject: [PATCH] Updated docstrings referring to `torch.expand` to point to `torch.Tensor.expand` (#140045) `torch.expand` was moved to `torch.Tensor.expand` but some docstrings still refer to `torch.expand` Pull Request resolved: https://github.com/pytorch/pytorch/pull/140045 Approved by: https://github.com/mikaylagawarecki --- torch/_torch_docs.py | 2 +- torch/autograd/gradcheck.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/torch/_torch_docs.py b/torch/_torch_docs.py index 3105c2f736e45..10b4e4159e099 100644 --- a/torch/_torch_docs.py +++ b/torch/_torch_docs.py @@ -13832,7 +13832,7 @@ def merge_dicts(*dicts): add_docstr( torch.expand_copy, r""" -Performs the same operation as :func:`torch.expand`, but all output tensors +Performs the same operation as :func:`torch.Tensor.expand`, but all output tensors are freshly created instead of aliasing the input. """, ) diff --git a/torch/autograd/gradcheck.py b/torch/autograd/gradcheck.py index c7ec4eba0cea3..ede7214645d3a 100644 --- a/torch/autograd/gradcheck.py +++ b/torch/autograd/gradcheck.py @@ -1998,7 +1998,7 @@ def gradcheck( .. warning:: If any checked tensor in :attr:`input` has overlapping memory, i.e., different indices pointing to the same memory address (e.g., from - :func:`torch.expand`), this check will likely fail because the numerical + :func:`torch.Tensor.expand`), this check will likely fail because the numerical gradients computed by point perturbation at such indices will change values at all other indices that share the same memory address. @@ -2152,7 +2152,7 @@ def gradgradcheck( .. warning:: If any checked tensor in :attr:`input` and :attr:`grad_outputs` has overlapping memory, i.e., different indices pointing to the same memory - address (e.g., from :func:`torch.expand`), this check will likely fail + address (e.g., from :func:`torch.Tensor.expand`), this check will likely fail because the numerical gradients computed by point perturbation at such indices will change values at all other indices that share the same memory address.