File size: 654 Bytes
aa3ac98 81fff32 aa3ac98 81fff32 aa3ac98 05bebc1 aa3ac98 9b13459 aa3ac98 05bebc1 9b13459 05bebc1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# "torch==2.8.0",
# "kernels-benchmark-tools",
# ]
#
# [tool.uv.sources]
# kernels-benchmark-tools = { path = "../../../../../tools", editable = true }
# ///
import torch
import sys
from kernels_benchmark_tools import KernelTypeEnum, run_benchmark
def torch_layer_norm(x, weight, bias, eps: float = 1e-5):
return torch.nn.functional.layer_norm(x, (x.shape[-1],), weight, bias, eps)
run_benchmark(
kernel_type=KernelTypeEnum.LAYER_NORM,
impl_name="torch_layer_norm",
impl_tags={"family": "torch", "op": "layer_norm"},
impl_func=torch_layer_norm,
) |