import { t as c, an as p, b as s } from "../index-DSGwv2Yx.js";
import f from "./BaseLayer.js";
import { E as u } from "../random_width-B_fVXhGx.js";
import { r as b } from "../exports_initializers-DIOZQt_L.js";
import { m as g } from "../mod-BXjLYwvM.js";
import { r as l } from "../range-BDxO73mk.js";
function h(e) {
  return new u(e);
}
class k extends f {
  wpe;
  // Position embeddings
  constructor(n, t = "", o) {
    super(n, o), this.wpe = h({
      inputDim: this.config.blockSize,
      outputDim: this.config.nEmbed,
      name: t,
      embeddingsInitializer: b({ mean: 0, stddev: 0.02 })
    });
  }
  forward(n, t) {
    const o = n.cache?.[0]?.length ?? 0;
    return c(() => {
      const [, i] = t.shape, r = this.config.blockSize, m = l(0, i, 1, "int32"), a = g(p(m, s(o, "int32")), s(r, "int32")), d = this.wpe.apply(a);
      return t.add(d);
    });
  }
}
export {
  k as default
};
