Skip to content
Merged
Changes from all commits
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
12 changes: 10 additions & 2 deletions lmdeploy/pytorch/kernels/ascend/rms_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
from torch import Tensor


def rms_norm(hidden_states: Tensor, weight: Tensor, epsilon: float = 1e-6):
return ext_ops.rms_norm(hidden_states, weight, epsilon)
def rms_norm(hidden_states: Tensor,
weight: Tensor,
eps: float = 1e-6,
out: Tensor = None):
rms_norm_out = ext_ops.rms_norm(hidden_states, weight, eps)
if out is None:
out = rms_norm_out
else:
out.copy_(rms_norm_out)
return rms_norm_out