Skip to content

Commit

Permalink
check complex in python
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottWong98 committed Aug 11, 2023
1 parent c7ba0ce commit c822064
Showing 1 changed file with 96 additions and 16 deletions.
112 changes: 96 additions & 16 deletions python/paddle/tensor/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def acos(x, name=None):
out = cos^{-1}(x)
Args:
x (Tensor): Input of Acos operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Acos operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -246,7 +246,17 @@ def acos(x, name=None):
return _C_ops.acos(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'acos'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'acos',
)
helper = LayerHelper('acos', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand All @@ -262,7 +272,7 @@ def acosh(x, name=None):
out = acosh(x)
Args:
x (Tensor): Input of Acosh operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Acosh operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -283,7 +293,17 @@ def acosh(x, name=None):
return _C_ops.acosh(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'acosh'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'acosh',
)
helper = LayerHelper('acosh', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand All @@ -299,7 +319,7 @@ def asin(x, name=None):
out = sin^{-1}(x)
Args:
x (Tensor): Input of Asin operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Asin operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -320,7 +340,17 @@ def asin(x, name=None):
return _C_ops.asin(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'asin'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'asin',
)
helper = LayerHelper('asin', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand All @@ -336,7 +366,7 @@ def asinh(x, name=None):
out = asinh(x)
Args:
x (Tensor): Input of Asinh operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Asinh operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -357,7 +387,17 @@ def asinh(x, name=None):
return _C_ops.asinh(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'asinh'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'asinh',
)
helper = LayerHelper('asinh', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand All @@ -373,7 +413,7 @@ def atan(x, name=None):
out = tan^{-1}(x)
Args:
x (Tensor): Input of Atan operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Atan operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -394,7 +434,17 @@ def atan(x, name=None):
return _C_ops.atan(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'atan'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'atan',
)
helper = LayerHelper('atan', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand All @@ -410,7 +460,7 @@ def atanh(x, name=None):
out = atanh(x)
Args:
x (Tensor): Input of Atan operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Atan operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -431,7 +481,17 @@ def atanh(x, name=None):
return _C_ops.atanh(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'atanh'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'atanh',
)
helper = LayerHelper('atanh', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand Down Expand Up @@ -529,7 +589,7 @@ def cosh(x, name=None):
out = \\frac{exp(x)+exp(-x)}{2}
Args:
x (Tensor): Input of Cosh operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Cosh operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -550,7 +610,17 @@ def cosh(x, name=None):
return _C_ops.cosh(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'cosh'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'cosh',
)
helper = LayerHelper('cosh', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand Down Expand Up @@ -904,7 +974,7 @@ def sinh(x, name=None):
out = sinh(x)
Args:
x (Tensor): Input of Sinh operator, an N-D Tensor, with data type float32, float64 or float16.
x (Tensor): Input of Sinh operator, an N-D Tensor, with data type float32, float64, float16, complex64 or complex128.
name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`.
Returns:
Expand All @@ -925,7 +995,17 @@ def sinh(x, name=None):
return _C_ops.sinh(x)
else:
check_variable_and_dtype(
x, 'x', ['float16', 'uint16', 'float32', 'float64'], 'sinh'
x,
'x',
[
'float16',
'uint16',
'float32',
'float64',
'complex64',
'complex128',
],
'sinh',
)
helper = LayerHelper('sinh', **locals())
out = helper.create_variable_for_type_inference(dtype=x.dtype)
Expand Down

0 comments on commit c822064

Please sign in to comment.