4 writes to weight
Microsoft.ML.GenAI.Core (4)
Module\GenAILinear.cs (1)
24
this.
weight
= torch.zeros(outFeatures, inFeatures, dtype: dtype, device: device);
Module\QuantizedLinear.cs (3)
57
this.
weight
= null;
71
this.
weight
= null;
203
this.
weight
= null;
21 references to weight
Microsoft.ML.GenAI.Core (21)
Module\GenAILinear.cs (1)
42
var weight2 = this.
weight
!.to_type(ScalarType.Float32);
Module\QuantizedLinear.cs (20)
19
if (this.
weight
is null)
24
if (this.
weight
.device_type != DeviceType.META)
33
var scale = 255 / (torch.max(this.
weight
, 1).values - torch.min(this.
weight
, 1).values);
36
var zeroPoint = -scale * torch.min(this.
weight
, 1).values - 128;
47
var eightBitWeight = torch.round(this.
weight
* scale.view(-1, 1) + zeroPoint.view(-1, 1)).to(torch.int8);
56
this.
weight
.Dispose();
66
var eightBitWeight = torch.zeros(this.
weight
.shape, dtype: torch.int8);
67
var zeroPoint = torch.zeros(this.
weight
.shape[0], dtype: torch.int8);
68
var scale = torch.zeros(this.
weight
.shape[0], dtype: torch.float32);
140
if (this.
weight
is null)
145
var fourBitWeightDim = this.
weight
.size(0) * this.
weight
.size(1);
147
if (this.
weight
.device_type != DeviceType.META)
154
var scale = 15 / (torch.max(this.
weight
, 1).values - torch.min(this.
weight
, 1).values);
157
var zeroPoint = -scale * torch.min(this.
weight
, 1).values - 8;
160
var fourBitWeight = torch.round(this.
weight
* scale.view(-1, 1) + zeroPoint.view(-1, 1)).to(torch.int8);
187
this.
weight
.Dispose();
200
var scale = torch.zeros(this.
weight
.shape[0], dtype: torch.float32);