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

add doc for numel Op (#2455)

上级 012b4786
......@@ -111,6 +111,7 @@ paddle
paddle/not_equal.rst
paddle/ones.rst
paddle/ones_like.rst
paddle/numel.rst
paddle/ParallelExecutor.rst
paddle/ParamAttr.rst
paddle/pow.rst
......
......@@ -74,6 +74,7 @@ paddle.tensor
tensor/not_equal.rst
tensor/ones.rst
tensor/ones_like.rst
tensor/numel.rst
tensor/pow.rst
tensor/random.rst
tensor/rank.rst
......
.. THIS FILE IS GENERATED BY `gen_doc.{py|sh}`
!DO NOT EDIT THIS FILE MANUALLY!
.. _api_tensor_numel:
numel
-------
.. autofunction:: paddle.tensor.numel
:noindex:
......@@ -105,6 +105,7 @@ paddle
paddle_cn/no_grad_cn.rst
paddle_cn/nonzero_cn.rst
paddle_cn/not_equal_cn.rst
paddle_cn/numel_cn.rst
paddle_cn/ones_cn.rst
paddle_cn/ones_like_cn.rst
paddle_cn/ParallelExecutor_cn.rst
......
......@@ -98,6 +98,7 @@ paddle.tensor
tensor_cn/nonzero_cn.rst
tensor_cn/norm_cn.rst
tensor_cn/not_equal_cn.rst
tensor_cn/numel_cn.rst
tensor_cn/ones_cn.rst
tensor_cn/ones_like_cn.rst
tensor_cn/pow_cn.rst
......
.. _cn_api_tensor_numel:
numel
-------------------------------
.. py:function:: paddle.numel(x)
该OP返回一个长度为1并且元素值为输入 ``x`` 元素个数的Tensor。
参数:
- **x** (Tensor) - 输入Tensor,数据类型为int32,int64, float16, float32, float64, int32, int64 。
返回: 返回长度为1并且元素值为 ``x`` 元素个数的Tensor。
抛出异常:
- ``TypeError`` - 当 ``x`` 不是Tensor或者 ``x`` 的数据类型不是bool、float16、float32、float64、int32或int64中的一个的时候
**代码示例**:
.. code-block:: python
import paddle
paddle.disable_static()
x = paddle.full(shape=[4, 5, 7], fill_value=0, dtype='int32')
numel = paddle.numel(x) # 140
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册