import "../random_width-B_fVXhGx.js";
import "../index-DSGwv2Yx.js";
import { r as s } from "../exports_initializers-DIOZQt_L.js";
import a from "./BaseLayer.js";
import { dot16 as o } from "../ops/dot16.js";
import { isPackedTensor as r } from "../utilities/packed.js";
import { p as m } from "../pack16-WlOSOuZA.js";
import { transpose16 as d } from "../ops/transpose16.js";
import { v as p } from "../variable-SSATClyt.js";
import { g as h } from "../gather-DEyjXNb1.js";
class g extends a {
  vocabSize;
  embedDim;
  initializer;
  WEIGHTS;
  constructor(t, i, e) {
    super(t, e), this.WEIGHTS = i, this.vocabSize = t.vocabSize, this.embedDim = t.nEmbed, this.initializer = s({
      mean: 0,
      stddev: 0.02
    }), this.addVariable(this.WEIGHTS, p(this.initializer.apply([this.vocabSize, this.embedDim]), !0, i));
  }
  embed(t) {
    return h(this.getVariable(this.WEIGHTS), t, 0);
  }
  project(t) {
    const i = r(t) ? m(this.getVariable(this.WEIGHTS), void 0, 32) : this.getVariable(this.WEIGHTS), e = d(i);
    return r(t) && i.dispose(), o(t, e);
  }
  // Dummy, should not be used.
  forward(t, i) {
    return this.project(i);
  }
}
export {
  g as default
};
