Skip to content

Instantly share code, notes, and snippets.

View L0SG's full-sized avatar

Sang-gil Lee L0SG

View GitHub Profile
@L0SG
L0SG / freeze_example.py
Last active October 12, 2023 05:02
PyTorch example: freezing a part of the net (including fine-tuning)
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.optim as optim
# toy feed-forward net
class Net(nn.Module):
def __init__(self):