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

Method forward

models/CNN1/cnn1.py:38–81  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

36 self.fc2 = nn.Linear(32, num_classes)
37
38 def forward(self, x):
39 # Convolution 1
40 out = self.conv1(x)
41 out = self.relu1(out)
42 out = out.reshape(out.shape[0], out.shape[1], -1)
43 # print('After convolution1:', out.shape)
44
45 # Convolution 2
46 out = self.conv2(out)
47 out = self.relu2(out)
48 # print('After convolution2:', out.shape)
49
50 # Max pool 1
51 out = self.maxpool1(out)
52 # print('After maxpool1:', out.shape)
53
54 # Convolution 3
55 out = self.conv3(out)
56 out = self.relu3(out)
57 # print('After convolution3:', out.shape)
58
59 # Convolution 4
60 out = self.conv4(out)
61 out = self.relu4(out)
62 # print('After convolution4:', out.shape)
63
64 # Max pool 2
65 out = self.maxpool2(out)
66 # print('After maxcpool2:', out.shape)
67
68 # flatten
69 out = out.view(out.size(0), -1)
70 # print('After flatten:', out.shape)
71
72 # Linear function 1
73 out = self.fc1(out)
74 out = self.relu5(out)
75 # print('After linear1:', out.shape)
76
77 # Linear function (readout)
78 out = self.fc2(out)
79 # print('After linear2:', out.shape)
80
81 return out

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected