未验证 提交 c4b1faa4 编写于 作者: L Li Fuchen 提交者: GitHub

modified sample code of add_position_encoding to use paddle.randn, test=document_fix (#27679)

上级 d3b98f0d
...@@ -13187,12 +13187,10 @@ def add_position_encoding(input, alpha, beta, name=None): ...@@ -13187,12 +13187,10 @@ def add_position_encoding(input, alpha, beta, name=None):
Examples: Examples:
.. code-block:: python .. code-block:: python
import numpy as np
import paddle import paddle
import paddle.nn.functional as F import paddle.nn.functional as F
tensor = np.random.randn(16, 32, 64) tensor = paddle.randn([16, 32, 64])
tensor = paddle.to_tensor(tensor)
position_tensor = F.add_position_encoding( position_tensor = F.add_position_encoding(
input=tensor, alpha=1.0, beta=1.0) input=tensor, alpha=1.0, beta=1.0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册