未验证 提交 f12e1a39 编写于 作者: W wangchaochaohu 提交者: GitHub

Remove "TypeError" from some files as required (#27019) (#27066)

上级 24e58181
...@@ -4815,11 +4815,6 @@ def split(input, num_or_sections, dim=-1, name=None): ...@@ -4815,11 +4815,6 @@ def split(input, num_or_sections, dim=-1, name=None):
Returns: Returns:
list(Tensor): The list of segmented Tensors. list(Tensor): The list of segmented Tensors.
Raises:
TypeError: The data type of ``input`` must be one of bool, float16, float32, float64, int32, int64.
TypeError: ``num_or_sections`` is not int, list or tuple.
TypeError: ``dim`` is not int or Tensor. The data type of ``dim`` must be int32 or int64 when it's a Tensor.
Example: Example:
.. code-block:: python .. code-block:: python
...@@ -6103,11 +6098,6 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None): ...@@ -6103,11 +6098,6 @@ def reshape(x, shape, actual_shape=None, act=None, inplace=False, name=None):
Returns: Returns:
Tensor: A reshaped Tensor with the same data type as ``x``. It is a new tensor variable if ``inplace`` is ``False``, otherwise it is ``x``. If ``act`` is None, return the reshaped tensor variable, otherwise return the activated tensor variable. Tensor: A reshaped Tensor with the same data type as ``x``. It is a new tensor variable if ``inplace`` is ``False``, otherwise it is ``x``. If ``act`` is None, return the reshaped tensor variable, otherwise return the activated tensor variable.
Raises:
TypeError: If actual_shape is neither Tensor nor None.
ValueError: If more than one elements of ``shape`` is -1.
ValueError: If the element of ``shape`` is 0, the corresponding dimension should be less than or equal to the dimension of ``x``.
ValueError: If the elements in ``shape`` is negative except -1.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -8256,10 +8246,6 @@ def gather(input, index, overwrite=True): ...@@ -8256,10 +8246,6 @@ def gather(input, index, overwrite=True):
Returns: Returns:
output (Tensor): The output is a tensor with the same rank as input. output (Tensor): The output is a tensor with the same rank as input.
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must to be one of float16, float32, float64, int32, int64, uint8.
TypeError: ``index`` must be a Tensor and the data type of ``index`` must be int32 or int64.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -8350,10 +8336,6 @@ def gather_nd(input, index, name=None): ...@@ -8350,10 +8336,6 @@ def gather_nd(input, index, name=None):
Returns: Returns:
output (Tensor): A tensor with the shape index.shape[:-1] + input.shape[index.shape[-1]:] output (Tensor): A tensor with the shape index.shape[:-1] + input.shape[index.shape[-1]:]
Raises:
TypeError: ``input`` must be a Tensor and the data type of ``input`` must be one of float32, float64, int32 and int64.
TypeError: ``index`` must be a Tensor and the data type of ``index`` must be one of int32 and int64.
Examples: Examples:
.. code-block:: python .. code-block:: python
......
...@@ -276,11 +276,6 @@ def concat(input, axis=0, name=None): ...@@ -276,11 +276,6 @@ def concat(input, axis=0, name=None):
name (str, optional): The default value is None. Normally there is no name (str, optional): The default value is None. Normally there is no
need for user to set this property. For more information, please need for user to set this property. For more information, please
refer to :ref:`api_guide_Name`. refer to :ref:`api_guide_Name`.
Raises:
TypeError: ``input`` must be one of list, tuple or Tensor.
TypeError: The data type of ``input`` must be one of bool, float16, float32, float64, int32 and int64.
TypeError: The ``axis`` must be int or Tensor. The dtype of ``axis`` must be int32 or int64 when it's a Tensor.
TypeError: All the Tensors in ``input`` must have the same data type.
Returns: Returns:
Tensor: A Tensor with the same data type as ``input``. Tensor: A Tensor with the same data type as ``input``.
...@@ -1453,14 +1448,6 @@ def linspace(start, stop, num, dtype=None, name=None): ...@@ -1453,14 +1448,6 @@ def linspace(start, stop, num, dtype=None, name=None):
the data shape of this tensor is :math:`[num]` . If the :attr:`num` is set 1, the output tensor just has \ the data shape of this tensor is :math:`[num]` . If the :attr:`num` is set 1, the output tensor just has \
the value with input :attr:`start`. the value with input :attr:`start`.
Raises:
TypeError: The ``dtype`` must be one of int32, int64, float32 and float64.
TypeError: The type of ``num`` must be int When it's not a Tensor.
TypeError: The data type of ``num`` must be int32 When it's a Tensor.
TypeError: The data type of ``start`` and ``stop`` must be same as ``dtype`` When it's a Tensor.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -1629,9 +1616,6 @@ def eye(num_rows, ...@@ -1629,9 +1616,6 @@ def eye(num_rows,
Returns: Returns:
Tensor: An identity Tensor or LoDTensor of shape batch_shape + [num_rows, num_columns]. Tensor: An identity Tensor or LoDTensor of shape batch_shape + [num_rows, num_columns].
Raises:
TypeError: The `dtype` must be one of float16, float32, float64, int32 and int64.
TypeError: The `num_columns` must be non-negative int.
Examples: Examples:
.. code-block:: python .. code-block:: python
......
...@@ -244,10 +244,6 @@ def full_like(x, fill_value, dtype=None, name=None): ...@@ -244,10 +244,6 @@ def full_like(x, fill_value, dtype=None, name=None):
Returns: Returns:
Tensor: Tensor which is created according to ``x``, ``fill_value`` and ``dtype``. Tensor: Tensor which is created according to ``x``, ``fill_value`` and ``dtype``.
Raises:
TypeError: The data type of ``x`` must be one of bool, float16, float32, float64, int32, int64.
TypeError: The ``dtype`` must be one of bool, float16, float32, float64, int32, int64 and None.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -303,11 +299,6 @@ def ones(shape, dtype=None, name=None): ...@@ -303,11 +299,6 @@ def ones(shape, dtype=None, name=None):
Returns: Returns:
Tensor: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 1. Tensor: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 1.
Raises:
TypeError: The ``dtype`` must be one of bool, float16, float32, float64, int32, int64 and None.
TypeError: The ``shape`` must be one of list, tuple and Tensor. The data type of ``shape`` must
be int32 or int64 when it's a Tensor.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -391,11 +382,6 @@ def zeros(shape, dtype=None, name=None): ...@@ -391,11 +382,6 @@ def zeros(shape, dtype=None, name=None):
Returns: Returns:
Tensor: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 0. Tensor: A tensor of data type :attr:`dtype` with shape :attr:`shape` and all elements set to 0.
Raises:
TypeError: The ``dtype`` must be one of bool, float16, float32, float64, int32, int64 and None.
TypeError: The ``shape`` must be one of list, tuple and Tensor. The data type of ``shape`` must
be int32 or int64 when it's a Tensor.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -481,10 +467,6 @@ def eye(num_rows, num_columns=None, dtype=None, name=None): ...@@ -481,10 +467,6 @@ def eye(num_rows, num_columns=None, dtype=None, name=None):
Returns: Returns:
Tensor: An identity Tensor or LoDTensor of shape [num_rows, num_columns]. Tensor: An identity Tensor or LoDTensor of shape [num_rows, num_columns].
Raises:
TypeError: The ``dtype`` must be one of float16, float32, float64, int32 int64 and None.
TypeError: The ``num_columns`` must be non-negative int.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -532,11 +514,6 @@ def full(shape, fill_value, dtype=None, name=None): ...@@ -532,11 +514,6 @@ def full(shape, fill_value, dtype=None, name=None):
Returns: Returns:
Tensor: Tensor which is created according to ``shape``, ``fill_value`` and ``dtype``. Tensor: Tensor which is created according to ``shape``, ``fill_value`` and ``dtype``.
Raises:
TypeError: The ``dtype`` must be one of None, bool, float16, float32, float64, int32 and int64.
TypeError: The ``shape`` must be one of Tensor, list and tuple. The data type of ``shape`` must
be int32 or int64 when the it's a Tensor
Examples: Examples:
.. code-block:: python .. code-block:: python
......
...@@ -85,11 +85,6 @@ def concat(x, axis=0, name=None): ...@@ -85,11 +85,6 @@ def concat(x, axis=0, name=None):
name (str, optional): The default value is None. Normally there is no name (str, optional): The default value is None. Normally there is no
need for user to set this property. For more information, please need for user to set this property. For more information, please
refer to :ref:`api_guide_Name`. refer to :ref:`api_guide_Name`.
Raises:
TypeError: ``x`` must be list or tuple.
TypeError: The data type of ``x`` must be one of bool, float16, float32, float64, int32 and int64.
TypeError: The ``axis`` must be int or Tensor. The dtype of ``axis`` must be int32 or int64 when it's a Tensor.
TypeError: All the Tensors in ``x`` must have the same data type.
Returns: Returns:
Tensor: A Tensor with the same data type as ``x``. Tensor: A Tensor with the same data type as ``x``.
...@@ -474,10 +469,7 @@ def split(x, num_or_sections, axis=0, name=None): ...@@ -474,10 +469,7 @@ def split(x, num_or_sections, axis=0, name=None):
For more information, please refer to :ref:`api_guide_Name` . For more information, please refer to :ref:`api_guide_Name` .
Returns: Returns:
list(Tensor): The list of segmented Tensors. list(Tensor): The list of segmented Tensors.
Raises:
TypeError: The data type of ``x`` must be one of bool, float16, float32, float64, int32, int64.
TypeError: ``num_or_sections`` is not int, list or tuple.
TypeError: ``axis`` is not int or Tensor. the data type of ``axis`` must be int32 or int64 when it's a Tensor.
Example: Example:
.. code-block:: python .. code-block:: python
...@@ -796,11 +788,6 @@ def gather(x, index, axis=None, name=None): ...@@ -796,11 +788,6 @@ def gather(x, index, axis=None, name=None):
Returns: Returns:
output (Tensor): The output is a tensor with the same rank as ``x``. output (Tensor): The output is a tensor with the same rank as ``x``.
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must to be one of float16, float32, float64, int32, int64, uint8.
TypeError: ``index`` must be a Tensor and the data type of ``index`` must be int32 or int64.
TypeError: ``axis`` must be a Tensor or int and the data type of ``index`` must be int32 or int64 when it's a Tensor.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -1002,10 +989,7 @@ def chunk(x, chunks, axis=0, name=None): ...@@ -1002,10 +989,7 @@ def chunk(x, chunks, axis=0, name=None):
For more information, please refer to :ref:`api_guide_Name` . For more information, please refer to :ref:`api_guide_Name` .
Returns: Returns:
list(Tensor): The list of segmented Tensors. list(Tensor): The list of segmented Tensors.
Raises:
TypeError: The data type of ``x`` must be one of bool, float16, float32, float64, int32, int64.
TypeError: ``chunks`` is not int.
TypeError: ``axis`` is not int or Tensor. the data type of ``axis`` must be int32 or int64 when it's a Tensor.
Example: Example:
.. code-block:: python .. code-block:: python
...@@ -1290,11 +1274,6 @@ def reshape(x, shape, name=None): ...@@ -1290,11 +1274,6 @@ def reshape(x, shape, name=None):
Returns: Returns:
Tensor: A reshaped Tensor with the same data type as ``x``. Tensor: A reshaped Tensor with the same data type as ``x``.
Raises:
ValueError: If more than one elements of ``shape`` is -1.
ValueError: If the element of ``shape`` is 0, the corresponding dimension should be less than or equal to the dimension of ``x``.
ValueError: If the elements in ``shape`` is negative except -1.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -1381,10 +1360,6 @@ def gather_nd(x, index, name=None): ...@@ -1381,10 +1360,6 @@ def gather_nd(x, index, name=None):
Returns: Returns:
output (Tensor): A tensor with the shape index.shape[:-1] + input.shape[index.shape[-1]:] output (Tensor): A tensor with the shape index.shape[:-1] + input.shape[index.shape[-1]:]
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must be one of float32, float64, int32 and int64.
TypeError: ``index`` must be a Tensor and the data type of ``index`` must be one of int32 and int64.
Examples: Examples:
.. code-block:: python .. code-block:: python
......
...@@ -287,10 +287,6 @@ def index_select(x, index, axis=0, name=None): ...@@ -287,10 +287,6 @@ def index_select(x, index, axis=0, name=None):
Returns: Returns:
Tensor: A Tensor with same data type as ``x``. Tensor: A Tensor with same data type as ``x``.
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must be one of float32, float64, int32 and int64.
TypeError: ``index`` must be a Tensor and the data type of ``index`` must be int32 or int64.
Examples: Examples:
.. code-block:: python .. code-block:: python
...@@ -670,10 +666,6 @@ def masked_select(x, mask, name=None): ...@@ -670,10 +666,6 @@ def masked_select(x, mask, name=None):
Returns: A 1-D Tensor which is the same data type as ``x``. Returns: A 1-D Tensor which is the same data type as ``x``.
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must be one of float32, float64, int32 and int64.
TypeError: ``mask`` must be a Tensor and the data type of ``mask`` must be bool.
Examples: Examples:
.. code-block:: python .. code-block:: python
......
...@@ -238,10 +238,6 @@ def numel(x, name=None): ...@@ -238,10 +238,6 @@ def numel(x, name=None):
Returns: Returns:
Tensor: The number of elements for the input Tensor. Tensor: The number of elements for the input Tensor.
Raises:
TypeError: ``x`` must be a Tensor and the data type of ``x`` must be one of bool, float16, float32, float64, int32, int64.
Examples: Examples:
.. code-block:: python .. code-block:: python
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册