Skip to content

Instantly share code, notes, and snippets.

View mllrkln's full-sized avatar

Florian mllrkln

View GitHub Profile
@mllrkln
mllrkln / file.md
Created August 3, 2018 18:03 — forked from chauhan-utk/file.md
PyTorch replace pretrained model layers

This code snippet shows how we can change a layer in a pretrained model. In the following code, we change all the ReLU activation functions with SELU in a resnet18 model.

import torch
from torchvision import model

resnet18 = model.resnet18(pretrained=True)

def funct(list_mods):