MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / gen_layernorm_inputs

Function gen_layernorm_inputs

bench.py:218–224  ·  view source on GitHub ↗
(size: dict, dtype: torch.dtype, device: str, seed: int = 42)

Source from the content-addressed store, hash-verified

216
217
218def gen_layernorm_inputs(size: dict, dtype: torch.dtype, device: str, seed: int = 42) -> dict:
219 torch.manual_seed(seed)
220 batch, dim = size["batch"], size["dim"]
221 x = torch.randn(batch, dim, device=device, dtype=dtype)
222 weight = torch.ones(dim, device=device, dtype=dtype)
223 bias = torch.zeros(dim, device=device, dtype=dtype)
224 return {"x": x, "weight": weight, "bias": bias}
225
226
227def gen_flash_attention_inputs(size: dict, dtype: torch.dtype, device: str, seed: int = 42) -> dict:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected