Skip to content

Instantly share code, notes, and snippets.

@juneoh
Created October 27, 2018 01:29
Show Gist options
  • Save juneoh/99267b043359d71504476973a1268a79 to your computer and use it in GitHub Desktop.
Save juneoh/99267b043359d71504476973a1268a79 to your computer and use it in GitHub Desktop.
PyTorch AlexNet for grayscale images
import torch.nn as nn
from torchvision.models import alexnet
model = alexnet(pretrained=True, num_classes=10)
model.features[0] = nn.Conv2d(1, 64, kernel_size=(11, 11), stride=(4, 4), padding=(2, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment