2 writes to Dtype
Microsoft.ML.GenAI.Phi (2)
Phi2\Config.cs (1)
39this.Dtype = ScalarType.Float32;
Phi2\Phi2ForCasualLM.cs (1)
60modelConfig.Dtype = torchDtype;
14 references to Dtype
Microsoft.ML.GenAI.Phi (14)
Module\Phi2Attention.cs (8)
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); 88this.cache_k = torch.zeros(maxBatch, this._numKeyValueHeads, maxLength, this._headDim, dtype: config.Dtype); 89this.cache_v = torch.zeros(maxBatch, this._numKeyValueHeads, maxLength, this._headDim, dtype: config.Dtype);
Module\Phi2DecoderLayer.cs (1)
38this.input_layernorm = nn.LayerNorm(config.HiddenSize, eps: config.LayerNormEps, dtype: config.Dtype);
Module\Phi2MLP.cs (2)
25this.fc1 = new GenAILinear(config.HiddenSize, config.IntermediateSize, dtype: config.Dtype); 26this.fc2 = new GenAILinear(config.IntermediateSize, config.HiddenSize, dtype: config.Dtype);
Module\Phi2Model.cs (2)
41this.embed_tokens = nn.Embedding(config.VocabSize, config.HiddenSize, dtype: config.Dtype); 43this.final_layernorm = nn.LayerNorm(config.HiddenSize, eps: config.LayerNormEps, dtype: config.Dtype);
Phi2\Phi2ForCasualLM.cs (1)
28this.lm_head = new GenAILinear(config.HiddenSize, config.VocabSize, dtype: config.Dtype);