Change the code tobuild a CNN consisting of 3 convolutional layers following with ReLU…
- User
Change the code tobuild a CNN consisting of 3 convolutional layers following with ReLU activation function, 1 pooling layer, 1 flatten layer and 1 linear layer (Please do not add/delete any other layers for this sub-question). Please design your network, train your network for 100 epochs and present the followings: i) plot the curves of training loss; ii) plot the curves of training accuracy and test accuracy; iii) report the best test accuracy that you can achieve.class NeuralNetwork(nn.Module): def init(self): super(NeuralNetwork, self).init() # self.flatten = nn.Flatten() self.conv = nn.Sequential( nn.Conv2d(3, 64, 7, 2, 2), nn.ReLU(), nn.Conv2d(64, 256, 3, 2, 1), nn.ReLU(), nn.Conv2d(256, 1024, 3, 2, 1), nn.ReLU(), ) self.gap = nn.AdaptiveAvgPool2d(output_size=1) self.flatten = nn.Flatten() self.linear = nn.Linear(1024, 10) def forward(self, x): # print(x.shape) x = self.conv(x) x = self.gap(x) x = self.flatten(x) # print(x.shape) logits = self.linear(x) return logits model = NeuralNetwork().to(device) print(model)
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.