For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
ReduceRMSNorm
struct ReduceRMSNorm
Registers the mo.reduce.rms_norm graph op with the graph compiler.
Implemented traitsβ
Methodsβ
executeβ
static def execute[dtype: DType, rank: Int, target: StringSlice[ImmStaticOrigin], multiply_before_cast: Bool = True](output: ManagedTensorSlice[IOSpec[_, _].FusedOutput, static_spec=output.static_spec], input: ManagedTensorSlice[IOSpec[_, _].FusedInput, static_spec=input.static_spec], gamma: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=gamma.static_spec], epsilon: Float32, weight_offset: Scalar[dtype], ctx: DeviceContext)
Executes the mo.reduce.rms_norm graph op.
Parameters:
- βdtype (
DType): Element type of the input and output tensors. - βrank (
Int): Tensor rank of the input and output tensors. - βtarget (
StringSlice[ImmStaticOrigin]): Compilation target string. - βmultiply_before_cast (
Bool): See the graph op signature.
Args:
- βoutput (
ManagedTensorSlice[IOSpec[_, _].FusedOutput, static_spec=output.static_spec]): Output tensor receiving the result. - βinput (
ManagedTensorSlice[IOSpec[_, _].FusedInput, static_spec=input.static_spec]): Input tensor to reduce. - βgamma (
ManagedTensorSlice[IOSpec[_, _].Input, static_spec=gamma.static_spec]): Per-column scale weights. - βepsilon (
Float32): Small constant for numerical stability. - βweight_offset (
Scalar[dtype]): Scalar offset added to the weight. - βctx (
DeviceContext): Device context used to enqueue the kernel.
Raises:
Error: If the operation parameters are invalid.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!