Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewzh112 committed Dec 15, 2020
1 parent 9e9a79e commit 3fb8aaa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion networks/layers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from torch import nn
import torch
from torch.utils.data import DataLoader
from utils.data import SimpleDataset
from data.labelled import SimpleDataset
from torch.nn import functional as F


Expand Down
4 changes: 2 additions & 2 deletions networks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def initialize_modules(model, nonlinearity='leaky_relu', init_type='kaiming'):
nn.init.xavier_uniform_(m.weight)
else:
print('unrecognized init type, using default PyTorch initialization scheme...')
elif isinstance(m, (nn.BatchNorm2d, nn.GroupNorm, nn.Linear)):
elif isinstance(m, (nn.BatchNorm2d, nn.GroupNorm, nn.Linear, nn.LayerNorm, nn.Embedding)):
nn.init.normal_(m.weight, 0.0, 0.02)
if m.bias is not None:
if hasattr(m, 'bias') and m.bias is not None:
nn.init.constant_(m.bias, 0)


Expand Down

0 comments on commit 3fb8aaa

Please sign in to comment.