Skip to content

Commit

Permalink
copy implementation from FOB
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixBenning committed May 12, 2024
1 parent d981bda commit dc0ebc9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Empty file.
25 changes: 25 additions & 0 deletions benchmarking/classification/cifar/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from torch import nn
from torchvision.models import resnet18


class Resnet18(nn.Module):
""" Resnet18 model for CIFAR-100 (modifactions based on FOB benchmark) """
def __init__(self):
super().__init__()
self.model = resnet18(num_classes=100, pretrained=False)
# 7x7 conv is too large for 32x32 images
self.model.conv1 = nn.Conv2d(
in_channels=3, # rgb color
out_channels=64,
kernel_size=3,
stride=1,
padding=4,
padding_mode="reflect",
)
# pooling small images is bad
self.model.maxpool = nn.Identity()

def forward(self, x):
return self.model(x)


0 comments on commit dc0ebc9

Please sign in to comment.