Add custom kernel for RMS normalization (#16)

This commit is contained in:
Woosuk Kwon
2023-03-31 09:51:22 -07:00
committed by GitHub
parent c45f3c3ab6
commit 09e9245478
9 changed files with 243 additions and 58 deletions

14
csrc/layernorm.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include <torch/extension.h>
void rms_norm(
torch::Tensor& out,
torch::Tensor& input,
torch::Tensor& weight,
float epsilon);
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def(
"rms_norm",
&rms_norm,
"Apply Root Mean Square (RMS) Normalization to the input tensor.");
}