We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
integrate content/images on broadcasting in docs
https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc explains broadcasting well (including useful diagrams) and is linked to from https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html. It is the only link to https://scipy.github.io/old-wiki left.

This content should be integrated in the user guide. There's also useful code to draw such diagrams at https://jakevdp.github.io/PythonDataScienceHandbook/02.05-computation-on-arrays-broadcasting.html

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `numpy/doc/broadcasting.py`
Content:
```
1 """
2 ========================
3 Broadcasting over arrays
4 ========================
5 
6 The term broadcasting describes how numpy treats arrays with different
7 shapes during arithmetic operations. Subject to certain constraints,
8 the smaller array is "broadcast" across the larger array so that they
9 have compatible shapes. Broadcasting provides a means of vectorizing
10 array operations so that looping occurs in C instead of Python. It does
11 this without making needless copies of data and usually leads to
12 efficient algorithm implementations. There are, however, cases where
13 broadcasting is a bad idea because it leads to inefficient use of memory
14 that slows computation.
15 
16 NumPy operations are usually done on pairs of arrays on an
17 element-by-element basis.  In the simplest case, the two arrays must
18 have exactly the same shape, as in the following example:
19 
20   >>> a = np.array([1.0, 2.0, 3.0])
21   >>> b = np.array([2.0, 2.0, 2.0])
22   >>> a * b
23   array([ 2.,  4.,  6.])
24 
25 NumPy's broadcasting rule relaxes this constraint when the arrays'
26 shapes meet certain constraints. The simplest broadcasting example occurs
27 when an array and a scalar value are combined in an operation:
28 
29 >>> a = np.array([1.0, 2.0, 3.0])
30 >>> b = 2.0
31 >>> a * b
32 array([ 2.,  4.,  6.])
33 
34 The result is equivalent to the previous example where ``b`` was an array.
35 We can think of the scalar ``b`` being *stretched* during the arithmetic
36 operation into an array with the same shape as ``a``. The new elements in
37 ``b`` are simply copies of the original scalar. The stretching analogy is
38 only conceptual.  NumPy is smart enough to use the original scalar value
39 without actually making copies, so that broadcasting operations are as
40 memory and computationally efficient as possible.
41 
42 The code in the second example is more efficient than that in the first
43 because broadcasting moves less memory around during the multiplication
44 (``b`` is a scalar rather than an array).
45 
46 General Broadcasting Rules
47 ==========================
48 When operating on two arrays, NumPy compares their shapes element-wise.
49 It starts with the trailing dimensions, and works its way forward.  Two
50 dimensions are compatible when
51 
52 1) they are equal, or
53 2) one of them is 1
54 
55 If these conditions are not met, a
56 ``ValueError: operands could not be broadcast together`` exception is 
57 thrown, indicating that the arrays have incompatible shapes. The size of 
58 the resulting array is the maximum size along each dimension of the input 
59 arrays.
60 
61 Arrays do not need to have the same *number* of dimensions.  For example,
62 if you have a ``256x256x3`` array of RGB values, and you want to scale
63 each color in the image by a different value, you can multiply the image
64 by a one-dimensional array with 3 values. Lining up the sizes of the
65 trailing axes of these arrays according to the broadcast rules, shows that
66 they are compatible::
67 
68   Image  (3d array): 256 x 256 x 3
69   Scale  (1d array):             3
70   Result (3d array): 256 x 256 x 3
71 
72 When either of the dimensions compared is one, the other is
73 used.  In other words, dimensions with size 1 are stretched or "copied"
74 to match the other.
75 
76 In the following example, both the ``A`` and ``B`` arrays have axes with
77 length one that are expanded to a larger size during the broadcast
78 operation::
79 
80   A      (4d array):  8 x 1 x 6 x 1
81   B      (3d array):      7 x 1 x 5
82   Result (4d array):  8 x 7 x 6 x 5
83 
84 Here are some more examples::
85 
86   A      (2d array):  5 x 4
87   B      (1d array):      1
88   Result (2d array):  5 x 4
89 
90   A      (2d array):  5 x 4
91   B      (1d array):      4
92   Result (2d array):  5 x 4
93 
94   A      (3d array):  15 x 3 x 5
95   B      (3d array):  15 x 1 x 5
96   Result (3d array):  15 x 3 x 5
97 
98   A      (3d array):  15 x 3 x 5
99   B      (2d array):       3 x 5
100   Result (3d array):  15 x 3 x 5
101 
102   A      (3d array):  15 x 3 x 5
103   B      (2d array):       3 x 1
104   Result (3d array):  15 x 3 x 5
105 
106 Here are examples of shapes that do not broadcast::
107 
108   A      (1d array):  3
109   B      (1d array):  4 # trailing dimensions do not match
110 
111   A      (2d array):      2 x 1
112   B      (3d array):  8 x 4 x 3 # second from last dimensions mismatched
113 
114 An example of broadcasting in practice::
115 
116  >>> x = np.arange(4)
117  >>> xx = x.reshape(4,1)
118  >>> y = np.ones(5)
119  >>> z = np.ones((3,4))
120 
121  >>> x.shape
122  (4,)
123 
124  >>> y.shape
125  (5,)
126 
127  >>> x + y
128  ValueError: operands could not be broadcast together with shapes (4,) (5,)
129 
130  >>> xx.shape
131  (4, 1)
132 
133  >>> y.shape
134  (5,)
135 
136  >>> (xx + y).shape
137  (4, 5)
138 
139  >>> xx + y
140  array([[ 1.,  1.,  1.,  1.,  1.],
141         [ 2.,  2.,  2.,  2.,  2.],
142         [ 3.,  3.,  3.,  3.,  3.],
143         [ 4.,  4.,  4.,  4.,  4.]])
144 
145  >>> x.shape
146  (4,)
147 
148  >>> z.shape
149  (3, 4)
150 
151  >>> (x + z).shape
152  (3, 4)
153 
154  >>> x + z
155  array([[ 1.,  2.,  3.,  4.],
156         [ 1.,  2.,  3.,  4.],
157         [ 1.,  2.,  3.,  4.]])
158 
159 Broadcasting provides a convenient way of taking the outer product (or
160 any other outer operation) of two arrays. The following example shows an
161 outer addition operation of two 1-d arrays::
162 
163   >>> a = np.array([0.0, 10.0, 20.0, 30.0])
164   >>> b = np.array([1.0, 2.0, 3.0])
165   >>> a[:, np.newaxis] + b
166   array([[  1.,   2.,   3.],
167          [ 11.,  12.,  13.],
168          [ 21.,  22.,  23.],
169          [ 31.,  32.,  33.]])
170 
171 Here the ``newaxis`` index operator inserts a new axis into ``a``,
172 making it a two-dimensional ``4x1`` array.  Combining the ``4x1`` array
173 with ``b``, which has shape ``(3,)``, yields a ``4x3`` array.
174 
175 See `this article <https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc>`_
176 for illustrations of broadcasting concepts.
177 
178 """
179 from __future__ import division, absolute_import, print_function
180
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/numpy/doc/broadcasting.py b/numpy/doc/broadcasting.py
--- a/numpy/doc/broadcasting.py
+++ b/numpy/doc/broadcasting.py
@@ -3,6 +3,12 @@
 Broadcasting over arrays
 ========================
 
+.. note::
+    See `this article
+    <https://numpy.org/devdocs/user/theory.broadcasting.html>`_
+    for illustrations of broadcasting concepts.
+
+
 The term broadcasting describes how numpy treats arrays with different
 shapes during arithmetic operations. Subject to certain constraints,
 the smaller array is "broadcast" across the larger array so that they
@@ -172,8 +178,5 @@
 making it a two-dimensional ``4x1`` array.  Combining the ``4x1`` array
 with ``b``, which has shape ``(3,)``, yields a ``4x3`` array.
 
-See `this article <https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc>`_
-for illustrations of broadcasting concepts.
-
 """
 from __future__ import division, absolute_import, print_function

{"golden_diff": "diff --git a/numpy/doc/broadcasting.py b/numpy/doc/broadcasting.py\n--- a/numpy/doc/broadcasting.py\n+++ b/numpy/doc/broadcasting.py\n@@ -3,6 +3,12 @@\n Broadcasting over arrays\n ========================\n \n+.. note::\n+    See `this article\n+    <https://numpy.org/devdocs/user/theory.broadcasting.html>`_\n+    for illustrations of broadcasting concepts.\n+\n+\n The term broadcasting describes how numpy treats arrays with different\n shapes during arithmetic operations. Subject to certain constraints,\n the smaller array is \"broadcast\" across the larger array so that they\n@@ -172,8 +178,5 @@\n making it a two-dimensional ``4x1`` array.  Combining the ``4x1`` array\n with ``b``, which has shape ``(3,)``, yields a ``4x3`` array.\n \n-See `this article <https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc>`_\n-for illustrations of broadcasting concepts.\n-\n \"\"\"\n from __future__ import division, absolute_import, print_function\n", "issue": "integrate content/images on broadcasting in docs\nhttps://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc explains broadcasting well (including useful diagrams) and is linked to from https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html. It is the only link to https://scipy.github.io/old-wiki left.\r\n\r\nThis content should be integrated in the user guide. There's also useful code to draw such diagrams at https://jakevdp.github.io/PythonDataScienceHandbook/02.05-computation-on-arrays-broadcasting.html\n", "before_files": [{"content": "\"\"\"\n========================\nBroadcasting over arrays\n========================\n\nThe term broadcasting describes how numpy treats arrays with different\nshapes during arithmetic operations. Subject to certain constraints,\nthe smaller array is \"broadcast\" across the larger array so that they\nhave compatible shapes. Broadcasting provides a means of vectorizing\narray operations so that looping occurs in C instead of Python. It does\nthis without making needless copies of data and usually leads to\nefficient algorithm implementations. There are, however, cases where\nbroadcasting is a bad idea because it leads to inefficient use of memory\nthat slows computation.\n\nNumPy operations are usually done on pairs of arrays on an\nelement-by-element basis.  In the simplest case, the two arrays must\nhave exactly the same shape, as in the following example:\n\n  >>> a = np.array([1.0, 2.0, 3.0])\n  >>> b = np.array([2.0, 2.0, 2.0])\n  >>> a * b\n  array([ 2.,  4.,  6.])\n\nNumPy's broadcasting rule relaxes this constraint when the arrays'\nshapes meet certain constraints. The simplest broadcasting example occurs\nwhen an array and a scalar value are combined in an operation:\n\n>>> a = np.array([1.0, 2.0, 3.0])\n>>> b = 2.0\n>>> a * b\narray([ 2.,  4.,  6.])\n\nThe result is equivalent to the previous example where ``b`` was an array.\nWe can think of the scalar ``b`` being *stretched* during the arithmetic\noperation into an array with the same shape as ``a``. The new elements in\n``b`` are simply copies of the original scalar. The stretching analogy is\nonly conceptual.  NumPy is smart enough to use the original scalar value\nwithout actually making copies, so that broadcasting operations are as\nmemory and computationally efficient as possible.\n\nThe code in the second example is more efficient than that in the first\nbecause broadcasting moves less memory around during the multiplication\n(``b`` is a scalar rather than an array).\n\nGeneral Broadcasting Rules\n==========================\nWhen operating on two arrays, NumPy compares their shapes element-wise.\nIt starts with the trailing dimensions, and works its way forward.  Two\ndimensions are compatible when\n\n1) they are equal, or\n2) one of them is 1\n\nIf these conditions are not met, a\n``ValueError: operands could not be broadcast together`` exception is \nthrown, indicating that the arrays have incompatible shapes. The size of \nthe resulting array is the maximum size along each dimension of the input \narrays.\n\nArrays do not need to have the same *number* of dimensions.  For example,\nif you have a ``256x256x3`` array of RGB values, and you want to scale\neach color in the image by a different value, you can multiply the image\nby a one-dimensional array with 3 values. Lining up the sizes of the\ntrailing axes of these arrays according to the broadcast rules, shows that\nthey are compatible::\n\n  Image  (3d array): 256 x 256 x 3\n  Scale  (1d array):             3\n  Result (3d array): 256 x 256 x 3\n\nWhen either of the dimensions compared is one, the other is\nused.  In other words, dimensions with size 1 are stretched or \"copied\"\nto match the other.\n\nIn the following example, both the ``A`` and ``B`` arrays have axes with\nlength one that are expanded to a larger size during the broadcast\noperation::\n\n  A      (4d array):  8 x 1 x 6 x 1\n  B      (3d array):      7 x 1 x 5\n  Result (4d array):  8 x 7 x 6 x 5\n\nHere are some more examples::\n\n  A      (2d array):  5 x 4\n  B      (1d array):      1\n  Result (2d array):  5 x 4\n\n  A      (2d array):  5 x 4\n  B      (1d array):      4\n  Result (2d array):  5 x 4\n\n  A      (3d array):  15 x 3 x 5\n  B      (3d array):  15 x 1 x 5\n  Result (3d array):  15 x 3 x 5\n\n  A      (3d array):  15 x 3 x 5\n  B      (2d array):       3 x 5\n  Result (3d array):  15 x 3 x 5\n\n  A      (3d array):  15 x 3 x 5\n  B      (2d array):       3 x 1\n  Result (3d array):  15 x 3 x 5\n\nHere are examples of shapes that do not broadcast::\n\n  A      (1d array):  3\n  B      (1d array):  4 # trailing dimensions do not match\n\n  A      (2d array):      2 x 1\n  B      (3d array):  8 x 4 x 3 # second from last dimensions mismatched\n\nAn example of broadcasting in practice::\n\n >>> x = np.arange(4)\n >>> xx = x.reshape(4,1)\n >>> y = np.ones(5)\n >>> z = np.ones((3,4))\n\n >>> x.shape\n (4,)\n\n >>> y.shape\n (5,)\n\n >>> x + y\n ValueError: operands could not be broadcast together with shapes (4,) (5,)\n\n >>> xx.shape\n (4, 1)\n\n >>> y.shape\n (5,)\n\n >>> (xx + y).shape\n (4, 5)\n\n >>> xx + y\n array([[ 1.,  1.,  1.,  1.,  1.],\n        [ 2.,  2.,  2.,  2.,  2.],\n        [ 3.,  3.,  3.,  3.,  3.],\n        [ 4.,  4.,  4.,  4.,  4.]])\n\n >>> x.shape\n (4,)\n\n >>> z.shape\n (3, 4)\n\n >>> (x + z).shape\n (3, 4)\n\n >>> x + z\n array([[ 1.,  2.,  3.,  4.],\n        [ 1.,  2.,  3.,  4.],\n        [ 1.,  2.,  3.,  4.]])\n\nBroadcasting provides a convenient way of taking the outer product (or\nany other outer operation) of two arrays. The following example shows an\nouter addition operation of two 1-d arrays::\n\n  >>> a = np.array([0.0, 10.0, 20.0, 30.0])\n  >>> b = np.array([1.0, 2.0, 3.0])\n  >>> a[:, np.newaxis] + b\n  array([[  1.,   2.,   3.],\n         [ 11.,  12.,  13.],\n         [ 21.,  22.,  23.],\n         [ 31.,  32.,  33.]])\n\nHere the ``newaxis`` index operator inserts a new axis into ``a``,\nmaking it a two-dimensional ``4x1`` array.  Combining the ``4x1`` array\nwith ``b``, which has shape ``(3,)``, yields a ``4x3`` array.\n\nSee `this article <https://scipy.github.io/old-wiki/pages/EricsBroadcastingDoc>`_\nfor illustrations of broadcasting concepts.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n", "path": "numpy/doc/broadcasting.py"}], "after_files": [{"content": "\"\"\"\n========================\nBroadcasting over arrays\n========================\n\n.. note::\n    See `this article\n    <https://numpy.org/devdocs/user/theory.broadcasting.html>`_\n    for illustrations of broadcasting concepts.\n\n\nThe term broadcasting describes how numpy treats arrays with different\nshapes during arithmetic operations. Subject to certain constraints,\nthe smaller array is \"broadcast\" across the larger array so that they\nhave compatible shapes. Broadcasting provides a means of vectorizing\narray operations so that looping occurs in C instead of Python. It does\nthis without making needless copies of data and usually leads to\nefficient algorithm implementations. There are, however, cases where\nbroadcasting is a bad idea because it leads to inefficient use of memory\nthat slows computation.\n\nNumPy operations are usually done on pairs of arrays on an\nelement-by-element basis.  In the simplest case, the two arrays must\nhave exactly the same shape, as in the following example:\n\n  >>> a = np.array([1.0, 2.0, 3.0])\n  >>> b = np.array([2.0, 2.0, 2.0])\n  >>> a * b\n  array([ 2.,  4.,  6.])\n\nNumPy's broadcasting rule relaxes this constraint when the arrays'\nshapes meet certain constraints. The simplest broadcasting example occurs\nwhen an array and a scalar value are combined in an operation:\n\n>>> a = np.array([1.0, 2.0, 3.0])\n>>> b = 2.0\n>>> a * b\narray([ 2.,  4.,  6.])\n\nThe result is equivalent to the previous example where ``b`` was an array.\nWe can think of the scalar ``b`` being *stretched* during the arithmetic\noperation into an array with the same shape as ``a``. The new elements in\n``b`` are simply copies of the original scalar. The stretching analogy is\nonly conceptual.  NumPy is smart enough to use the original scalar value\nwithout actually making copies, so that broadcasting operations are as\nmemory and computationally efficient as possible.\n\nThe code in the second example is more efficient than that in the first\nbecause broadcasting moves less memory around during the multiplication\n(``b`` is a scalar rather than an array).\n\nGeneral Broadcasting Rules\n==========================\nWhen operating on two arrays, NumPy compares their shapes element-wise.\nIt starts with the trailing dimensions, and works its way forward.  Two\ndimensions are compatible when\n\n1) they are equal, or\n2) one of them is 1\n\nIf these conditions are not met, a\n``ValueError: operands could not be broadcast together`` exception is \nthrown, indicating that the arrays have incompatible shapes. The size of \nthe resulting array is the maximum size along each dimension of the input \narrays.\n\nArrays do not need to have the same *number* of dimensions.  For example,\nif you have a ``256x256x3`` array of RGB values, and you want to scale\neach color in the image by a different value, you can multiply the image\nby a one-dimensional array with 3 values. Lining up the sizes of the\ntrailing axes of these arrays according to the broadcast rules, shows that\nthey are compatible::\n\n  Image  (3d array): 256 x 256 x 3\n  Scale  (1d array):             3\n  Result (3d array): 256 x 256 x 3\n\nWhen either of the dimensions compared is one, the other is\nused.  In other words, dimensions with size 1 are stretched or \"copied\"\nto match the other.\n\nIn the following example, both the ``A`` and ``B`` arrays have axes with\nlength one that are expanded to a larger size during the broadcast\noperation::\n\n  A      (4d array):  8 x 1 x 6 x 1\n  B      (3d array):      7 x 1 x 5\n  Result (4d array):  8 x 7 x 6 x 5\n\nHere are some more examples::\n\n  A      (2d array):  5 x 4\n  B      (1d array):      1\n  Result (2d array):  5 x 4\n\n  A      (2d array):  5 x 4\n  B      (1d array):      4\n  Result (2d array):  5 x 4\n\n  A      (3d array):  15 x 3 x 5\n  B      (3d array):  15 x 1 x 5\n  Result (3d array):  15 x 3 x 5\n\n  A      (3d array):  15 x 3 x 5\n  B      (2d array):       3 x 5\n  Result (3d array):  15 x 3 x 5\n\n  A      (3d array):  15 x 3 x 5\n  B      (2d array):       3 x 1\n  Result (3d array):  15 x 3 x 5\n\nHere are examples of shapes that do not broadcast::\n\n  A      (1d array):  3\n  B      (1d array):  4 # trailing dimensions do not match\n\n  A      (2d array):      2 x 1\n  B      (3d array):  8 x 4 x 3 # second from last dimensions mismatched\n\nAn example of broadcasting in practice::\n\n >>> x = np.arange(4)\n >>> xx = x.reshape(4,1)\n >>> y = np.ones(5)\n >>> z = np.ones((3,4))\n\n >>> x.shape\n (4,)\n\n >>> y.shape\n (5,)\n\n >>> x + y\n ValueError: operands could not be broadcast together with shapes (4,) (5,)\n\n >>> xx.shape\n (4, 1)\n\n >>> y.shape\n (5,)\n\n >>> (xx + y).shape\n (4, 5)\n\n >>> xx + y\n array([[ 1.,  1.,  1.,  1.,  1.],\n        [ 2.,  2.,  2.,  2.,  2.],\n        [ 3.,  3.,  3.,  3.,  3.],\n        [ 4.,  4.,  4.,  4.,  4.]])\n\n >>> x.shape\n (4,)\n\n >>> z.shape\n (3, 4)\n\n >>> (x + z).shape\n (3, 4)\n\n >>> x + z\n array([[ 1.,  2.,  3.,  4.],\n        [ 1.,  2.,  3.,  4.],\n        [ 1.,  2.,  3.,  4.]])\n\nBroadcasting provides a convenient way of taking the outer product (or\nany other outer operation) of two arrays. The following example shows an\nouter addition operation of two 1-d arrays::\n\n  >>> a = np.array([0.0, 10.0, 20.0, 30.0])\n  >>> b = np.array([1.0, 2.0, 3.0])\n  >>> a[:, np.newaxis] + b\n  array([[  1.,   2.,   3.],\n         [ 11.,  12.,  13.],\n         [ 21.,  22.,  23.],\n         [ 31.,  32.,  33.]])\n\nHere the ``newaxis`` index operator inserts a new axis into ``a``,\nmaking it a two-dimensional ``4x1`` array.  Combining the ``4x1`` array\nwith ``b``, which has shape ``(3,)``, yields a ``4x3`` array.\n\n\"\"\"\nfrom __future__ import division, absolute_import, print_function\n", "path": "numpy/doc/broadcasting.py"}]}