import { m as n, $ as l } from "./index-DSGwv2Yx.js";
import { e as o, r as t, p as f, l as a, s as p, a as i } from "./step-DQY6_ABw.js";
import { r as m } from "./relu-DTvZKBsZ.js";
import { r as d } from "./reshape-BIN71H3p.js";
import { s as g } from "./sum-D39FeU5h.js";
function L(e, r, s) {
  if (s == null || s === "linear")
    return e;
  if (s === "relu")
    return n(e, i(r));
  throw new Error(`Cannot compute gradient for fused activation ${s}.`);
}
function S(e, r) {
  let s = r;
  const u = l(e.shape, r.shape);
  return u.length > 0 && (s = g(s, u)), d(s, e.shape);
}
function k(e, r, s, u) {
  if (r === "linear")
    return e;
  if (r === "relu")
    return m(e);
  if (r === "elu")
    return o(e);
  if (r === "relu6")
    return t(e);
  if (r === "prelu")
    return f(e, s);
  if (r === "leakyrelu")
    return a(e, u);
  if (r === "sigmoid")
    return p(e);
  throw new Error(`Unknown fused activation ${r}.`);
}
const C = (e, r) => !(e > 0) || r === "linear";
const F = 1.7580993408473768, U = 1.0507009873554805;
export {
  U as S,
  F as a,
  k as b,
  L as c,
  S as g,
  C as s
};
