Browse Source

Fix weight decay comment (#4228)

modifyDataloader
Glenn Jocher GitHub 3 years ago
parent
commit
8d3c3ef45c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      train.py

+ 2
- 2
train.py View File

for v in model.modules(): for v in model.modules():
if hasattr(v, 'bias') and isinstance(v.bias, nn.Parameter): # bias if hasattr(v, 'bias') and isinstance(v.bias, nn.Parameter): # bias
g2.append(v.bias) g2.append(v.bias)
if isinstance(v, nn.BatchNorm2d): # weight with decay
if isinstance(v, nn.BatchNorm2d): # weight (no decay)
g0.append(v.weight) g0.append(v.weight)
elif hasattr(v, 'weight') and isinstance(v.weight, nn.Parameter): # weight without decay
elif hasattr(v, 'weight') and isinstance(v.weight, nn.Parameter): # weight (with decay)
g1.append(v.weight) g1.append(v.weight)


if opt.adam: if opt.adam:

Loading…
Cancel
Save