MCPcopy Create free account
hub / github.com/BICLab/SpikingBrain-7B / forward

Method forward

W8ASpike/quant_linear.py:68–78  ·  view source on GitHub ↗
(self, weight)

Source from the content-addressed store, hash-verified

66 self.register_buffer('zeros', None)
67
68 def forward(self, weight):
69 # BLD
70 assert not self.training
71 org_type = weight.dtype
72 if self.w_group_size is not None:
73 weight = weight.reshape(self.out_features, -1, self.w_group_size)
74 weight = (weight / self.scales).round() * self.scales
75 return weight.reshape(self.out_features, self.in_features).to(org_type)
76 else:
77 weight = (weight / self.scales).round() * self.scales
78 return weight.to(org_type)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected