From e66453568b685dee47d6e6e634b3a47edffcaeed Mon Sep 17 00:00:00 2001 From: Tina Oberoi <55803680+tinaoberoi@users.noreply.github.com> Date: Sat, 9 May 2020 11:16:58 +0530 Subject: Update Docs : point users of np.outer to np.multiply.outer (#16182) * Update notes for numpy.outer and numpy.multiply.outer * Add tenserdot to numpy.outer documentation Co-authored-by: Eric Wieser --- numpy/core/_add_newdocs.py | 10 ++++++++-- numpy/core/numeric.py | 7 +++++-- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'numpy') diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index e54103634..f43b77c44 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -5009,7 +5009,7 @@ add_newdoc('numpy.core', 'ufunc', ('reduceat', """)) add_newdoc('numpy.core', 'ufunc', ('outer', - """ + r""" outer(A, B, **kwargs) Apply the ufunc `op` to all pairs (a, b) with a in `A` and b in `B`. @@ -5043,7 +5043,13 @@ add_newdoc('numpy.core', 'ufunc', ('outer', See Also -------- - numpy.outer + numpy.outer : A less powerful version of ``np.multiply.outer`` + that `ravel`\ s all inputs to 1D. This exists + primarily for compatibility with old code. + + tensordot : ``np.tensordot(a, b, axes=((), ()))`` and + ``np.multiply.outer(a, b)`` behave same for all + dimensions of a and b. Examples -------- diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 83d985a7c..17b435c74 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -857,8 +857,11 @@ def outer(a, b, out=None): -------- inner einsum : ``einsum('i,j->ij', a.ravel(), b.ravel())`` is the equivalent. - ufunc.outer : A generalization to N dimensions and other operations. - ``np.multiply.outer(a.ravel(), b.ravel())`` is the equivalent. + ufunc.outer : A generalization to dimensions other than 1D and other + operations. ``np.multiply.outer(a.ravel(), b.ravel())`` + is the equivalent. + tensordot : ``np.tensordot(a.ravel(), b.ravel(), axes=((), ()))`` + is the equivalent. References ---------- -- cgit v1.2.1