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

modified sample code of add_position_encoding to 2.0 (#2683)

* add cn doc of trace API

* modified sample code of add_position_encoding to 2.0
上级 9a5c2d45
...@@ -40,13 +40,13 @@ add_position_encoding ...@@ -40,13 +40,13 @@ add_position_encoding
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid import numpy as np
import paddle
import paddle.nn.functional as F
tensor = fluid.data( tensor = np.random.randn(16, 32, 64)
name='tensor', tensor = paddle.to_tensor(tensor)
shape=[None, 64, 512], position_tensor = F.add_position_encoding(
dtype='float32')
position_tensor = fluid.layers.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.
先完成此消息的编辑!
想要评论请 注册