class Mnist_CNN([nn.Module](https://docs.pytorch.org/docs/stable/generated/torch.nn.Module.html#torch.nn.Module "torch.nn.Module")): def __init__(self): super().__init__() self.conv1 = [nn.Conv2d](https://docs.pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d "torch.nn.Conv2d")(1, 16, kernel_size=3, stride=2, padding=1) self.conv2 = [nn.Conv2d](https://docs.pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d "torch.nn.Conv2d")(16, 16, kernel_size=3, stride=2, padding=1) self.conv3 = [nn.Conv2d](https://docs.pytorch.org/docs/stable/generated/torch.nn.Conv2d.html#torch.nn.Conv2d "torch.nn.Conv2d")(16, 10, kernel_size=3, stride=2, padding=1) def forward(self, [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor")): [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").view(-1, 1, 28, 28) [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = [F.relu](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.relu.html#torch.nn.functional.relu "torch.nn.functional.relu")(self.conv1([xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"))) [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = [F.relu](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.relu.html#torch.nn.functional.relu "torch.nn.functional.relu")(self.conv2([xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"))) [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = [F.relu](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.relu.html#torch.nn.functional.relu "torch.nn.functional.relu")(self.conv3([xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"))) [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor") = [F.avg_pool2d](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.avg_pool2d.html#torch.nn.functional.avg_pool2d "torch.nn.functional.avg_pool2d")([xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor"), 4) return [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").view(-1, [xb](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor "torch.Tensor").size(1)) lr = 0.1