42 references to ModelUtils
Microsoft.ML.TorchSharp (42)
NasBert\Models\NasBertEncoder.cs (11)
98
ModelUtils
.InitNormal(TokenEmbedding.weight, mean: 0.0, std: 0.02);
99
ModelUtils
.InitZeros(TokenEmbedding.weight[paddingIdx]);
102
ModelUtils
.InitNormal(SegmentEmbedding.weight, mean: 0.0, std: 0.02);
131
ModelUtils
.FreezeModuleParams(TokenEmbedding);
132
ModelUtils
.FreezeModuleParams(PositionalEmbedding);
133
ModelUtils
.FreezeModuleParams(SegmentEmbedding);
134
ModelUtils
.FreezeModuleParams(EmbeddingLayerNorm);
139
ModelUtils
.FreezeModuleParams(Layers);
140
ModelUtils
.FreezeModuleParams(HiddenTransferList);
145
ModelUtils
.FreezeModuleParams(HiddenTransferList);
150
ModelUtils
.FreezeModuleParams(Layers[i]);
NasBert\Models\NasBertModel.cs (1)
44
ModelUtils
.FreezeModuleParams(Encoder);
NasBert\Models\PredictionHead.cs (2)
23
ModelUtils
.InitXavierUniform(dense.weight);
24
ModelUtils
.InitZeros(dense.bias);
NasBert\Models\SequenceLabelHead.cs (2)
25
ModelUtils
.InitXavierUniform(dense.weight);
26
ModelUtils
.InitZeros(dense.bias);
NasBert\Modules\ConvSeparable.cs (3)
29
ModelUtils
.InitNormal(conv1.weight, mean: 0, std: std);
30
ModelUtils
.InitNormal(conv2.weight, mean: 0, std: std);
31
ModelUtils
.InitConstant(conv2.bias, 0);
NasBert\Modules\Embedding\LearnedPositionalEmbedding.cs (2)
28
ModelUtils
.InitNormal(Embedding.weight, mean: 0, std: Math.Pow(EmbeddingDim, -0.5));
29
ModelUtils
.InitZeros(Embedding.weight[PadPositionIndex]);
NasBert\Modules\EmbedTransfer.cs (2)
78
ModelUtils
.InitXavierUniform(HiddenTransfer.weight);
79
ModelUtils
.InitZeros(HiddenTransfer.bias);
NasBert\Modules\HiddenTransfer.cs (2)
37
ModelUtils
.InitNormal(InHiddenTransfer.weight, mean: 0.0, std: 0.02);
38
ModelUtils
.InitZeros(InHiddenTransfer.bias);
NasBert\Modules\Layers\FeedForwardLayer.cs (4)
48
ModelUtils
.InitNormal(fullConnected1.weight, mean: 0.0, std: 0.02);
49
ModelUtils
.InitZeros(fullConnected1.bias);
50
ModelUtils
.InitNormal(fullConnected2.weight, mean: 0.0, std: 0.02);
51
ModelUtils
.InitZeros(fullConnected2.bias);
NasBert\Modules\MultiHeadAttention.cs (13)
112
ModelUtils
.InitXavierUniform(QProjection.weight, 1.0 / Math.Sqrt(2.0));
113
ModelUtils
.InitXavierUniform(KProjection.weight, 1.0 / Math.Sqrt(2.0));
114
ModelUtils
.InitXavierUniform(VProjection.weight, 1.0 / Math.Sqrt(2.0));
118
ModelUtils
.InitXavierUniform(QProjection.weight);
119
ModelUtils
.InitXavierUniform(KProjection.weight);
120
ModelUtils
.InitXavierUniform(VProjection.weight);
123
ModelUtils
.InitXavierUniform(OutProjLinear.weight);
127
ModelUtils
.InitConstant(QProjection.bias, 0);
128
ModelUtils
.InitConstant(KProjection.bias, 0);
129
ModelUtils
.InitConstant(VProjection.bias, 0);
130
ModelUtils
.InitConstant(OutProjLinear.bias, 0);
135
ModelUtils
.InitXavierUniform(KBias);
136
ModelUtils
.InitXavierUniform(VBias);