MCPcopy Create free account
hub / github.com/boyiwei/alignment-attribution-code / __init__

Method __init__

lib/layerwrapper.py:11–23  ·  view source on GitHub ↗
(self, layer, layer_id=0, layer_name="none")

Source from the content-addressed store, hash-verified

9 """
10
11 def __init__(self, layer, layer_id=0, layer_name="none"):
12 self.layer = layer
13 self.dev = self.layer.weight.device
14 self.rows = layer.weight.data.shape[0]
15 self.columns = layer.weight.data.shape[1]
16
17 self.scaler_row = torch.zeros((self.columns), device=self.dev)
18 # self.activations = [torch.zeros((self.columns), device=self.dev)]
19 self.activations = []
20 self.nsamples = 0
21
22 self.layer_id = layer_id
23 self.layer_name = layer_name
24
25 def add_batch(self, inp, out, tar):
26 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected