Repository where I mostly put random python scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
467 B

  1. import torch.nn as nn
  2. import torch.nn.functional as F
  3. # CNN architecture definition
  4. class Net(nn.Module):
  5. def __init__(self):
  6. super(Net, self).__init__()
  7. # convolutional layer
  8. self.conv1 = nn.Conv2d(3, 16, 3, padding=1)
  9. # max pooling layer
  10. self.pool = nn.MaxPool2d(2, 2)
  11. def forward(self, x):
  12. # add sequence of convolutional and max pooling layers
  13. x = self.pool(F.relu(self.conv1(x)))
  14. return x