Skip to content

【Paddle Tensor No.21】docs: Add docs for Tensor.bitwise_invert #6932

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/api/paddle/Tensor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,15 @@ bitwise_not(out=None, name=None)

请参考 :ref:`cn_api_paddle_bitwise_not`

bitwise_invert(out=None, name=None)
:::::::::

返回:按位取反运算后的结果

返回类型:Tensor

请参考 :ref:`cn_api_paddle_bitwise_invert`

bitwise_or(y, out=None, name=None)
:::::::::

Expand Down
32 changes: 32 additions & 0 deletions docs/api/paddle/bitwise_invert_cn.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _cn_api_paddle_bitwise_invert:

bitwise_invert
-------------------------------

.. py:function:: paddle.bitwise_invert(x, out=None, name=None)

对 Tensor ``x`` 逐元素进行 ``按位取反`` 运算。

.. math::
Out = \sim X

.. note::
``paddle.bitwise_invert`` 遵守 broadcasting,如您想了解更多,请参见 `Tensor 介绍`_ .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么会出现broadcasting的相关描述呢?包括英文的API docstring,bitwise系列都是一元运算,与broadcast没有任何关系吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/PaddlePaddle/docs/blob/develop/docs/api/paddle/bitwise_not_cn.rst

bitwise_not似乎也有一样的问题,我直接复刻过来没有仔细检查。

我要不要修改一起修改一下?以及我发现里面一些链接坏了: line 14 Tenosr介绍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/PaddlePaddle/docs/blob/develop/docs/api/paddle/bitwise_not_cn.rst

bitwise_not似乎也有一样的问题,我直接复刻过来没有仔细检查。

我要不要修改一起修改一下?以及我发现里面一些链接坏了: line 14 Tenosr介绍

暂时只先考虑这个API吧,其他的API之后有时间有精力的话可以再提交一个PR

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的


.. _Tensor 介绍: ../../guides/beginner/tensor_cn.html#id7

参数
::::::::::::

- **x** (Tensor)- 输入的 N-D `Tensor`,数据类型为:bool,uint8,int8,int16,int32,int64。
- **out** (Tensor,可选)- 输出的结果 `Tensor`,是与输入数据类型相同的 N-D `Tensor`。默认值为 None,此时将创建新的 Tensor 来保存输出结果。
- **name** (str,可选) - 具体用法请参见 :ref:`api_guide_Name`,一般无需设置,默认值为 None。

返回
::::::::::::
``按位取反`` 运算后的结果 ``Tensor``,数据类型与 ``x`` 相同。

代码示例
::::::::::::

COPY-FROM: paddle.bitwise_invert