import { e as s } from "../index-DSGwv2Yx.js";
import "./cpu/normRMS.js";
import "./webgl/normRMS.js";
import "./grads/normRMS.js";
function R(e, r) {
  if (e.rank === 4) {
    const [t, p, ...i] = e.shape, c = [t * p, ...i], o = e.reshape(c), n = s().runKernel(
      r ? "RMSNorm" : "RMSNormNoGamma",
      r ? { x: o, gamma: r } : { x: o }
    );
    o.dispose();
    const h = n.reshape(e.shape);
    return n.dispose(), h;
  }
  return s().runKernel(r ? "RMSNorm" : "RMSNormNoGamma", r ? { x: e, gamma: r } : { x: e });
}
export {
  R as normRMS
};
