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

Method forward

models/CNN2/cnn2.py:44–93  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

42 self.fc2 = nn.Linear(32, num_classes)
43
44 def forward(self, x):
45 # Convolution 1
46 out = self.conv1(x)
47 # print('After convolution1:', out.shape)
48
49 out = self.bn1(out)
50 # print('After bn1:', out.shape)
51
52 out = self.prelu1(out)
53 out = out.reshape(out.shape[0], out.shape[1], -1)
54 # print('After prelu1:', out.shape)
55
56 # Convolution 2
57 out = self.conv2(out)
58 out = self.bn2(out)
59 out = self.prelu2(out)
60 # print('After convolution2, bn2, prelu2:', out.shape)
61
62 # Convolution 3
63 out = self.conv3(out)
64 out = self.bn3(out)
65 out = self.prelu3(out)
66 # print('After convolution3, bn3, prelu3:', out.shape)
67
68 # Convolution 4
69 out = self.conv4(out)
70 out = self.bn4(out)
71 out = self.prelu4(out)
72 # print('After convolution4, bn4, prelu4:', out.shape)
73
74 # Convolution 5
75 out = self.conv5(out)
76 out = self.bn5(out)
77 out = self.prelu5(out)
78 # print('After convolution5, bn5, prelu5:', out.shape)
79
80 # flatten
81 out = out.view(out.size(0), -1)
82 # print('After flatten:', out.shape)
83
84 # Linear function 1
85 out = self.fc1(out)
86 out = self.prelu6(out)
87 # print('After fc1:', out.shape)
88
89 # Linear function (readout)
90 out = self.fc2(out)
91 # print('After fc2:', out.shape)
92
93 return out

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected