import { c as o, e as i } from "./index-DSGwv2Yx.js";
import { isPackedTensor as t } from "./utilities/packed.js";
import { s as u } from "./slice-BvItlgXu.js";
const s = {
  kernelName: "Unpack16",
  inputsToSave: [],
  outputsToSave: [],
  gradFunc: (n) => ({
    x: () => d(n)
  })
};
o(s);
function p(n, a = 1, e = !1) {
  if (!t(n))
    return n;
  const r = i().runKernel("Unpack16", { x: n }, { scaling: a });
  return e && n.dispose(), r;
}
const c = {
  kernelName: "Pack16",
  inputsToSave: [],
  outputsToSave: [],
  gradFunc: (n, a, e) => ({
    x: () => {
      const r = p(n);
      return e.originalShape && e.padding && e.padding > 0 ? u(r, new Array(r.shape.length).fill(0), e.originalShape) : r;
    }
  })
};
o(c);
function d(n, a = 1, e = 0) {
  return i().runKernel("Pack16", { x: n }, { scaling: a, padding: e });
}
export {
  s as a,
  c as b,
  d as p,
  p as u
};
