Skip to content

Commit

Permalink
Add document
Browse files Browse the repository at this point in the history
  • Loading branch information
MARD1NO committed Jul 10, 2023
1 parent 1c5c8a7 commit 4f6a6a5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions python/paddle/incubate/nn/functional/rms_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,32 @@


def rms_norm(x, weight, bias, epsilon, begin_norm_axis):
r"""
Apply RMSNorm kernel.
Args:
x (Tensor): the input Tensor..
weight (Tensor): the weight Tensor to affine output.
bias (Tensor): the bias Tensor to affine output.
epsilon (float): a small float number to avoid divide 0.
begin_norm_axis (int): the begin axis to normalize.
Returns:
Tensor: the output Tensor.
Examples:
.. code-block:: python
# required: gpu
import paddle
paddle_x = paddle.cast(paddle.randn(shape=[32, 256]), dtype=paddle.float16)
paddle_weight = paddle.cast(paddle.randn(shape=[256]), dtype=paddle.float16)
paddle_bias = paddle.cast(paddle.randn(shape=[256]), dtype=paddle.float16)
epsilon = 1e-6
paddle_rmsnorm = paddle.incubate.nn.functional.rms_norm(paddle_x, paddle_weight, paddle_bias, epsilon, 1)
"""

if in_dygraph_mode():
return _C_ops.rms_norm(x, weight, bias, epsilon, begin_norm_axis)

Expand Down

0 comments on commit 4f6a6a5

Please sign in to comment.