import { c as u, _ as h, $ as d } from "../../index-DSGwv2Yx.js";
import { sum16 as c } from "../sum16.js";
import { reshape16 as p } from "../reshape16.js";
const A = {
  kernelName: "Add16",
  inputsToSave: ["a", "b"],
  gradFunc: (s, i) => {
    const [t, a] = i, n = h(t.shape, a.shape);
    if (Array.isArray(s))
      throw new Error("Add16 gradFunc expected dy to be a Tensor but got an array");
    return { a: () => {
      let e = s;
      const r = d(t.shape, n);
      r.length > 0 && (e = c(e, r));
      const o = p(e, t.shape);
      return e.dispose(), o;
    }, b: () => {
      let e = s;
      const r = d(a.shape, n);
      r.length > 0 && (e = c(e, r));
      const o = p(e, a.shape);
      return e.dispose(), o;
    } };
  }
};
u(A);
