1 write to _hiddenSize
Microsoft.ML.GenAI.Phi (1)
Module\Phi2Attention.cs (1)
61this._hiddenSize = config.HiddenSize;
9 references to _hiddenSize
Microsoft.ML.GenAI.Phi (9)
Module\Phi2Attention.cs (9)
63this._headDim = this._hiddenSize / this._numAttentionHeads; 70Contract.Assert(this._hiddenSize % (this._headDim * this._numAttentionHeads) == 0, "hidden_size must be divisible by num_attention_heads"); 71this.q_proj = new GenAILinear(this._hiddenSize, this._numAttentionHeads * this._headDim, hasBias: true, dtype: config.Dtype); 72this.k_proj = new GenAILinear(this._hiddenSize, this._numKeyValueHeads * this._headDim, hasBias: true, dtype: config.Dtype); 73this.v_proj = new GenAILinear(this._hiddenSize, this._numKeyValueHeads * this._headDim, hasBias: true, dtype: config.Dtype); 74this.dense = new GenAILinear(this._numAttentionHeads * this._headDim, this._hiddenSize, hasBias: true, dtype: config.Dtype); 79this.q_layernorm = nn.LayerNorm(this._hiddenSize / this._numAttentionHeads, eps: config.LayerNormEps, elementwise_affine: true, dtype: config.Dtype); 80this.k_layernorm = nn.LayerNorm(this._hiddenSize / this._numAttentionHeads, eps: config.LayerNormEps, elementwise_affine: true, dtype: config.Dtype); 156attnOutput = attnOutput.reshape(batchSize, seqLen, this._hiddenSize);