MCPcopy Create free account
hub / github.com/FinancialComputingUCL/LOBFrame / BL_layer

Class BL_layer

models/TABL/bl_layer.py:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4
5
6class BL_layer(pl.LightningModule):
7 def __init__(self, d2, d1, t1, t2):
8 super().__init__()
9 weight1 = torch.Tensor(d2, d1)
10 self.W1 = nn.Parameter(weight1)
11 nn.init.kaiming_uniform_(self.W1, nonlinearity='relu')
12
13 weight2 = torch.Tensor(t1, t2)
14 self.W2 = nn.Parameter(weight2)
15 nn.init.kaiming_uniform_(self.W2, nonlinearity='relu')
16
17 bias1 = torch.zeros((d2, t2))
18 self.B = nn.Parameter(bias1)
19 nn.init.constant_(self.B, 0)
20
21 self.activation = nn.ReLU()
22
23 def forward(self, x):
24
25 x = self.activation(self.W1 @ x @ self.W2 + self.B)
26
27 return x

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected