We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG]Cannot pass zero-dimensional tensor as both arguments into `mt.arctan2`
## Describe the bug
When I use the `mt.arctan2`, if i pass zero-dimensional tensors as both arguments, an error will be raised. If any argument is not zero-dimensional, the codes will work.

## To Reproduce
```
vx = mt.dot((1,0,0),(0,1,0))
vy = mt.dot((1,0,0),(0,0,1))
t = mt.arctan2(vx, vy)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
~/anaconda3/lib/python3.7/site-packages/mars/core.py in __len__(self)
    533         try:
--> 534             return self.shape[0]
    535         except IndexError:

IndexError: tuple index out of range

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
<ipython-input-23-09c63447ea86> in <module>
----> 1 mt.arctan2(vx, vy)

~/anaconda3/lib/python3.7/site-packages/mars/tensor/utils.py in h(*tensors, **kw)
    256                 kw['dtype'] = dtype
    257 
--> 258             ret = func(*tensors, **kw)
    259             if ret is NotImplemented:
    260                 reverse_func = getattr(inspect.getmodule(func), 'r{0}'.format(func.__name__), None) \

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/arctan2.py in arctan2(x1, x2, out, where, **kwargs)
    125     """
    126     op = TensorArctan2(**kwargs)
--> 127     return op(x1, x2, out=out, where=where)

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in __call__(self, x1, x2, out, where)
    268 
    269     def __call__(self, x1, x2, out=None, where=None):
--> 270         return self._call(x1, x2, out=out, where=where)
    271 
    272     def rcall(self, x1, x2, out=None, where=None):

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _call(self, x1, x2, out, where)
    251 
    252         inputs = filter_inputs([x1, x2, out, where])
--> 253         t = self.new_tensor(inputs, shape, order=order)
    254 
    255         if out is None:

~/anaconda3/lib/python3.7/site-packages/mars/tensor/operands.py in new_tensor(self, inputs, shape, dtype, order, **kw)
     77             raise TypeError('cannot new tensor with more than 1 outputs')
     78 
---> 79         return self.new_tensors(inputs, shape=shape, dtype=dtype, order=order, **kw)[0]
     80 
     81     @classmethod

~/anaconda3/lib/python3.7/site-packages/mars/tensor/operands.py in new_tensors(self, inputs, shape, dtype, order, chunks, nsplits, output_limit, kws, **kw)
     71                     output_limit=None, kws=None, **kw):
     72         return self.new_tileables(inputs, shape=shape, chunks=chunks, nsplits=nsplits,
---> 73                                   output_limit=output_limit, kws=kws, dtype=dtype, order=order, **kw)
     74 
     75     def new_tensor(self, inputs, shape, dtype=None, order=None, **kw):

~/anaconda3/lib/python3.7/site-packages/mars/operands.py in new_tileables(self, inputs, kws, **kw)
    352         """
    353 
--> 354         tileables = self._new_tileables(inputs, kws=kws, **kw)
    355         if is_eager_mode():
    356             ExecutableTuple(tileables).execute(fetch=False)

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _new_tileables(self, inputs, kws, **kw)
     70 
     71     def _new_tileables(self, inputs, kws=None, **kw):
---> 72         self._set_sparse(inputs)
     73         return super()._new_tileables(
     74             inputs, kws=kws, **kw)

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _set_sparse(self, inputs)
    188         x1 = self._lhs if np.isscalar(self._lhs) else next(inputs_iter)
    189         x2 = self._rhs if np.isscalar(self._rhs) else next(inputs_iter)
--> 190         setattr(self, '_sparse', self._is_sparse(x1, x2))
    191 
    192     def _set_inputs(self, inputs):

~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/arctan2.py in _is_sparse(cls, x1, x2)
     33         if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):
     34             return True
---> 35         elif x1 == 0:
     36             return True
     37         return False

~/anaconda3/lib/python3.7/site-packages/mars/tensor/core.py in __len__(self)
    279 
    280     def __len__(self):
--> 281         return len(self._data)
    282 
    283     @property

~/anaconda3/lib/python3.7/site-packages/mars/core.py in __len__(self)
    536             if build_mode().is_build_mode:
    537                 return 0
--> 538             raise TypeError('len() of unsized object')
    539 
    540     @property

TypeError: len() of unsized object
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mars/tensor/arithmetic/arctan2.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Copyright 1999-2020 Alibaba Group Holding Ltd.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 
17 import numpy as np
18 
19 from ... import opcodes as OperandDef
20 from ..utils import infer_dtype
21 from .core import TensorBinOp
22 from .utils import arithmetic_operand
23 
24 
25 @arithmetic_operand
26 class TensorArctan2(TensorBinOp):
27     _op_type_ = OperandDef.ARCTAN2
28     _func_name = 'arctan2'
29 
30     @classmethod
31     def _is_sparse(cls, x1, x2):
32         # x2 is sparse or not does not matter
33         if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):
34             return True
35         elif x1 == 0:
36             return True
37         return False
38 
39 
40 @infer_dtype(np.arctan2)
41 def arctan2(x1, x2, out=None, where=None, **kwargs):
42     """
43     Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.
44 
45     The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is
46     the signed angle in radians between the ray ending at the origin and
47     passing through the point (1,0), and the ray ending at the origin and
48     passing through the point (`x2`, `x1`).  (Note the role reversal: the
49     "`y`-coordinate" is the first function parameter, the "`x`-coordinate"
50     is the second.)  By IEEE convention, this function is defined for
51     `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see
52     Notes for specific values).
53 
54     This function is not defined for complex-valued arguments; for the
55     so-called argument of complex values, use `angle`.
56 
57     Parameters
58     ----------
59     x1 : array_like, real-valued
60         `y`-coordinates.
61     x2 : array_like, real-valued
62         `x`-coordinates. `x2` must be broadcastable to match the shape of
63         `x1` or vice versa.
64     out : Tensor, None, or tuple of Tensor and None, optional
65         A location into which the result is stored. If provided, it must have
66         a shape that the inputs broadcast to. If not provided or `None`,
67         a freshly-allocated tensor is returned. A tuple (possible only as a
68         keyword argument) must have length equal to the number of outputs.
69     where : array_like, optional
70         Values of True indicate to calculate the ufunc at that position, values
71         of False indicate to leave the value in the output alone.
72     **kwargs
73 
74     Returns
75     -------
76     angle : Tensor
77         Array of angles in radians, in the range ``[-pi, pi]``.
78 
79     See Also
80     --------
81     arctan, tan, angle
82 
83     Notes
84     -----
85     *arctan2* is identical to the `atan2` function of the underlying
86     C library.  The following special values are defined in the C
87     standard: [1]_
88 
89     ====== ====== ================
90     `x1`   `x2`   `arctan2(x1,x2)`
91     ====== ====== ================
92     +/- 0  +0     +/- 0
93     +/- 0  -0     +/- pi
94      > 0   +/-inf +0 / +pi
95      < 0   +/-inf -0 / -pi
96     +/-inf +inf   +/- (pi/4)
97     +/-inf -inf   +/- (3*pi/4)
98     ====== ====== ================
99 
100     Note that +0 and -0 are distinct floating point numbers, as are +inf
101     and -inf.
102 
103     References
104     ----------
105     .. [1] ISO/IEC standard 9899:1999, "Programming language C."
106 
107     Examples
108     --------
109     Consider four points in different quadrants:
110     >>> import mars.tensor as mt
111 
112     >>> x = mt.array([-1, +1, +1, -1])
113     >>> y = mt.array([-1, -1, +1, +1])
114     >>> (mt.arctan2(y, x) * 180 / mt.pi).execute()
115     array([-135.,  -45.,   45.,  135.])
116 
117     Note the order of the parameters. `arctan2` is defined also when `x2` = 0
118     and at several other special points, obtaining values in
119     the range ``[-pi, pi]``:
120 
121     >>> mt.arctan2([1., -1.], [0., 0.]).execute()
122     array([ 1.57079633, -1.57079633])
123     >>> mt.arctan2([0., 0., mt.inf], [+0., -0., mt.inf]).execute()
124     array([ 0.        ,  3.14159265,  0.78539816])
125     """
126     op = TensorArctan2(**kwargs)
127     return op(x1, x2, out=out, where=where)
128
```
--- 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/mars/tensor/arithmetic/arctan2.py b/mars/tensor/arithmetic/arctan2.py
--- a/mars/tensor/arithmetic/arctan2.py
+++ b/mars/tensor/arithmetic/arctan2.py
@@ -29,11 +29,12 @@
 
     @classmethod
     def _is_sparse(cls, x1, x2):
-        # x2 is sparse or not does not matter
-        if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):
-            return True
-        elif x1 == 0:
+        if hasattr(x1, 'issparse') and x1.issparse():
+            # if x1 is sparse, will be sparse always
             return True
+        elif np.isscalar(x1) and x1 == 0:
+            # x1 == 0, return sparse if x2 is
+            return x2.issparse() if hasattr(x2, 'issparse') else False
         return False

{"golden_diff": "diff --git a/mars/tensor/arithmetic/arctan2.py b/mars/tensor/arithmetic/arctan2.py\n--- a/mars/tensor/arithmetic/arctan2.py\n+++ b/mars/tensor/arithmetic/arctan2.py\n@@ -29,11 +29,12 @@\n \n     @classmethod\n     def _is_sparse(cls, x1, x2):\n-        # x2 is sparse or not does not matter\n-        if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):\n-            return True\n-        elif x1 == 0:\n+        if hasattr(x1, 'issparse') and x1.issparse():\n+            # if x1 is sparse, will be sparse always\n             return True\n+        elif np.isscalar(x1) and x1 == 0:\n+            # x1 == 0, return sparse if x2 is\n+            return x2.issparse() if hasattr(x2, 'issparse') else False\n         return False\n", "issue": "[BUG]Cannot pass zero-dimensional tensor as both arguments into `mt.arctan2`\n## Describe the bug\r\nWhen I use the `mt.arctan2`, if i pass zero-dimensional tensors as both arguments, an error will be raised. If any argument is not zero-dimensional, the codes will work.\r\n\r\n## To Reproduce\r\n```\r\nvx = mt.dot((1,0,0),(0,1,0))\r\nvy = mt.dot((1,0,0),(0,0,1))\r\nt = mt.arctan2(vx, vy)\r\n---------------------------------------------------------------------------\r\nIndexError                                Traceback (most recent call last)\r\n~/anaconda3/lib/python3.7/site-packages/mars/core.py in __len__(self)\r\n    533         try:\r\n--> 534             return self.shape[0]\r\n    535         except IndexError:\r\n\r\nIndexError: tuple index out of range\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTypeError                                 Traceback (most recent call last)\r\n<ipython-input-23-09c63447ea86> in <module>\r\n----> 1 mt.arctan2(vx, vy)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/utils.py in h(*tensors, **kw)\r\n    256                 kw['dtype'] = dtype\r\n    257 \r\n--> 258             ret = func(*tensors, **kw)\r\n    259             if ret is NotImplemented:\r\n    260                 reverse_func = getattr(inspect.getmodule(func), 'r{0}'.format(func.__name__), None) \\\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/arctan2.py in arctan2(x1, x2, out, where, **kwargs)\r\n    125     \"\"\"\r\n    126     op = TensorArctan2(**kwargs)\r\n--> 127     return op(x1, x2, out=out, where=where)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in __call__(self, x1, x2, out, where)\r\n    268 \r\n    269     def __call__(self, x1, x2, out=None, where=None):\r\n--> 270         return self._call(x1, x2, out=out, where=where)\r\n    271 \r\n    272     def rcall(self, x1, x2, out=None, where=None):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _call(self, x1, x2, out, where)\r\n    251 \r\n    252         inputs = filter_inputs([x1, x2, out, where])\r\n--> 253         t = self.new_tensor(inputs, shape, order=order)\r\n    254 \r\n    255         if out is None:\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/operands.py in new_tensor(self, inputs, shape, dtype, order, **kw)\r\n     77             raise TypeError('cannot new tensor with more than 1 outputs')\r\n     78 \r\n---> 79         return self.new_tensors(inputs, shape=shape, dtype=dtype, order=order, **kw)[0]\r\n     80 \r\n     81     @classmethod\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/operands.py in new_tensors(self, inputs, shape, dtype, order, chunks, nsplits, output_limit, kws, **kw)\r\n     71                     output_limit=None, kws=None, **kw):\r\n     72         return self.new_tileables(inputs, shape=shape, chunks=chunks, nsplits=nsplits,\r\n---> 73                                   output_limit=output_limit, kws=kws, dtype=dtype, order=order, **kw)\r\n     74 \r\n     75     def new_tensor(self, inputs, shape, dtype=None, order=None, **kw):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/operands.py in new_tileables(self, inputs, kws, **kw)\r\n    352         \"\"\"\r\n    353 \r\n--> 354         tileables = self._new_tileables(inputs, kws=kws, **kw)\r\n    355         if is_eager_mode():\r\n    356             ExecutableTuple(tileables).execute(fetch=False)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _new_tileables(self, inputs, kws, **kw)\r\n     70 \r\n     71     def _new_tileables(self, inputs, kws=None, **kw):\r\n---> 72         self._set_sparse(inputs)\r\n     73         return super()._new_tileables(\r\n     74             inputs, kws=kws, **kw)\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/core.py in _set_sparse(self, inputs)\r\n    188         x1 = self._lhs if np.isscalar(self._lhs) else next(inputs_iter)\r\n    189         x2 = self._rhs if np.isscalar(self._rhs) else next(inputs_iter)\r\n--> 190         setattr(self, '_sparse', self._is_sparse(x1, x2))\r\n    191 \r\n    192     def _set_inputs(self, inputs):\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/arithmetic/arctan2.py in _is_sparse(cls, x1, x2)\r\n     33         if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):\r\n     34             return True\r\n---> 35         elif x1 == 0:\r\n     36             return True\r\n     37         return False\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/tensor/core.py in __len__(self)\r\n    279 \r\n    280     def __len__(self):\r\n--> 281         return len(self._data)\r\n    282 \r\n    283     @property\r\n\r\n~/anaconda3/lib/python3.7/site-packages/mars/core.py in __len__(self)\r\n    536             if build_mode().is_build_mode:\r\n    537                 return 0\r\n--> 538             raise TypeError('len() of unsized object')\r\n    539 \r\n    540     @property\r\n\r\nTypeError: len() of unsized object\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright 1999-2020 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport numpy as np\n\nfrom ... import opcodes as OperandDef\nfrom ..utils import infer_dtype\nfrom .core import TensorBinOp\nfrom .utils import arithmetic_operand\n\n\n@arithmetic_operand\nclass TensorArctan2(TensorBinOp):\n    _op_type_ = OperandDef.ARCTAN2\n    _func_name = 'arctan2'\n\n    @classmethod\n    def _is_sparse(cls, x1, x2):\n        # x2 is sparse or not does not matter\n        if hasattr(x1, 'issparse') and x1.issparse() and np.isscalar(x2):\n            return True\n        elif x1 == 0:\n            return True\n        return False\n\n\n@infer_dtype(np.arctan2)\ndef arctan2(x1, x2, out=None, where=None, **kwargs):\n    \"\"\"\n    Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.\n\n    The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is\n    the signed angle in radians between the ray ending at the origin and\n    passing through the point (1,0), and the ray ending at the origin and\n    passing through the point (`x2`, `x1`).  (Note the role reversal: the\n    \"`y`-coordinate\" is the first function parameter, the \"`x`-coordinate\"\n    is the second.)  By IEEE convention, this function is defined for\n    `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see\n    Notes for specific values).\n\n    This function is not defined for complex-valued arguments; for the\n    so-called argument of complex values, use `angle`.\n\n    Parameters\n    ----------\n    x1 : array_like, real-valued\n        `y`-coordinates.\n    x2 : array_like, real-valued\n        `x`-coordinates. `x2` must be broadcastable to match the shape of\n        `x1` or vice versa.\n    out : Tensor, None, or tuple of Tensor and None, optional\n        A location into which the result is stored. If provided, it must have\n        a shape that the inputs broadcast to. If not provided or `None`,\n        a freshly-allocated tensor is returned. A tuple (possible only as a\n        keyword argument) must have length equal to the number of outputs.\n    where : array_like, optional\n        Values of True indicate to calculate the ufunc at that position, values\n        of False indicate to leave the value in the output alone.\n    **kwargs\n\n    Returns\n    -------\n    angle : Tensor\n        Array of angles in radians, in the range ``[-pi, pi]``.\n\n    See Also\n    --------\n    arctan, tan, angle\n\n    Notes\n    -----\n    *arctan2* is identical to the `atan2` function of the underlying\n    C library.  The following special values are defined in the C\n    standard: [1]_\n\n    ====== ====== ================\n    `x1`   `x2`   `arctan2(x1,x2)`\n    ====== ====== ================\n    +/- 0  +0     +/- 0\n    +/- 0  -0     +/- pi\n     > 0   +/-inf +0 / +pi\n     < 0   +/-inf -0 / -pi\n    +/-inf +inf   +/- (pi/4)\n    +/-inf -inf   +/- (3*pi/4)\n    ====== ====== ================\n\n    Note that +0 and -0 are distinct floating point numbers, as are +inf\n    and -inf.\n\n    References\n    ----------\n    .. [1] ISO/IEC standard 9899:1999, \"Programming language C.\"\n\n    Examples\n    --------\n    Consider four points in different quadrants:\n    >>> import mars.tensor as mt\n\n    >>> x = mt.array([-1, +1, +1, -1])\n    >>> y = mt.array([-1, -1, +1, +1])\n    >>> (mt.arctan2(y, x) * 180 / mt.pi).execute()\n    array([-135.,  -45.,   45.,  135.])\n\n    Note the order of the parameters. `arctan2` is defined also when `x2` = 0\n    and at several other special points, obtaining values in\n    the range ``[-pi, pi]``:\n\n    >>> mt.arctan2([1., -1.], [0., 0.]).execute()\n    array([ 1.57079633, -1.57079633])\n    >>> mt.arctan2([0., 0., mt.inf], [+0., -0., mt.inf]).execute()\n    array([ 0.        ,  3.14159265,  0.78539816])\n    \"\"\"\n    op = TensorArctan2(**kwargs)\n    return op(x1, x2, out=out, where=where)\n", "path": "mars/tensor/arithmetic/arctan2.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# Copyright 1999-2020 Alibaba Group Holding Ltd.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport numpy as np\n\nfrom ... import opcodes as OperandDef\nfrom ..utils import infer_dtype\nfrom .core import TensorBinOp\nfrom .utils import arithmetic_operand\n\n\n@arithmetic_operand\nclass TensorArctan2(TensorBinOp):\n    _op_type_ = OperandDef.ARCTAN2\n    _func_name = 'arctan2'\n\n    @classmethod\n    def _is_sparse(cls, x1, x2):\n        if hasattr(x1, 'issparse') and x1.issparse():\n            # if x1 is sparse, will be sparse always\n            return True\n        elif np.isscalar(x1) and x1 == 0:\n            # x1 == 0, return sparse if x2 is\n            return x2.issparse() if hasattr(x2, 'issparse') else False\n        return False\n\n\n@infer_dtype(np.arctan2)\ndef arctan2(x1, x2, out=None, where=None, **kwargs):\n    \"\"\"\n    Element-wise arc tangent of ``x1/x2`` choosing the quadrant correctly.\n\n    The quadrant (i.e., branch) is chosen so that ``arctan2(x1, x2)`` is\n    the signed angle in radians between the ray ending at the origin and\n    passing through the point (1,0), and the ray ending at the origin and\n    passing through the point (`x2`, `x1`).  (Note the role reversal: the\n    \"`y`-coordinate\" is the first function parameter, the \"`x`-coordinate\"\n    is the second.)  By IEEE convention, this function is defined for\n    `x2` = +/-0 and for either or both of `x1` and `x2` = +/-inf (see\n    Notes for specific values).\n\n    This function is not defined for complex-valued arguments; for the\n    so-called argument of complex values, use `angle`.\n\n    Parameters\n    ----------\n    x1 : array_like, real-valued\n        `y`-coordinates.\n    x2 : array_like, real-valued\n        `x`-coordinates. `x2` must be broadcastable to match the shape of\n        `x1` or vice versa.\n    out : Tensor, None, or tuple of Tensor and None, optional\n        A location into which the result is stored. If provided, it must have\n        a shape that the inputs broadcast to. If not provided or `None`,\n        a freshly-allocated tensor is returned. A tuple (possible only as a\n        keyword argument) must have length equal to the number of outputs.\n    where : array_like, optional\n        Values of True indicate to calculate the ufunc at that position, values\n        of False indicate to leave the value in the output alone.\n    **kwargs\n\n    Returns\n    -------\n    angle : Tensor\n        Array of angles in radians, in the range ``[-pi, pi]``.\n\n    See Also\n    --------\n    arctan, tan, angle\n\n    Notes\n    -----\n    *arctan2* is identical to the `atan2` function of the underlying\n    C library.  The following special values are defined in the C\n    standard: [1]_\n\n    ====== ====== ================\n    `x1`   `x2`   `arctan2(x1,x2)`\n    ====== ====== ================\n    +/- 0  +0     +/- 0\n    +/- 0  -0     +/- pi\n     > 0   +/-inf +0 / +pi\n     < 0   +/-inf -0 / -pi\n    +/-inf +inf   +/- (pi/4)\n    +/-inf -inf   +/- (3*pi/4)\n    ====== ====== ================\n\n    Note that +0 and -0 are distinct floating point numbers, as are +inf\n    and -inf.\n\n    References\n    ----------\n    .. [1] ISO/IEC standard 9899:1999, \"Programming language C.\"\n\n    Examples\n    --------\n    Consider four points in different quadrants:\n    >>> import mars.tensor as mt\n\n    >>> x = mt.array([-1, +1, +1, -1])\n    >>> y = mt.array([-1, -1, +1, +1])\n    >>> (mt.arctan2(y, x) * 180 / mt.pi).execute()\n    array([-135.,  -45.,   45.,  135.])\n\n    Note the order of the parameters. `arctan2` is defined also when `x2` = 0\n    and at several other special points, obtaining values in\n    the range ``[-pi, pi]``:\n\n    >>> mt.arctan2([1., -1.], [0., 0.]).execute()\n    array([ 1.57079633, -1.57079633])\n    >>> mt.arctan2([0., 0., mt.inf], [+0., -0., mt.inf]).execute()\n    array([ 0.        ,  3.14159265,  0.78539816])\n    \"\"\"\n    op = TensorArctan2(**kwargs)\n    return op(x1, x2, out=out, where=where)\n", "path": "mars/tensor/arithmetic/arctan2.py"}]}