import { torch } from "js-pytorch"; const nn = torch.nn; class Transformer extends nn.Module { constructor(vocab_size, hidden_size, n_timesteps, n_heads, p) { super(); // Instantiate Transformer's Layers: this.embed = new nn.Embedding(vocab_size, hidden_size); this.pos_embed = new nn.PositionalEmbedding(n_timesteps, hidden_size); this.b1 = new nn.Block( hidden_size, hidden_size, n_heads, n_timeste