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

my_2.0rc
Li Fuchen 5 years ago committed by GitHub
parent d3b98f0d84
commit c4b1faa469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13187,12 +13187,10 @@ def add_position_encoding(input, alpha, beta, name=None):
Examples:
.. code-block:: python
import numpy as np
import paddle
import paddle.nn.functional as F
tensor = np.random.randn(16, 32, 64)
tensor = paddle.to_tensor(tensor)
tensor = paddle.randn([16, 32, 64])
position_tensor = F.add_position_encoding(
input=tensor, alpha=1.0, beta=1.0)

Loading…
Cancel
Save