Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use kaiming initialization for conv layers #98

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dacapo/experiments/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ def __init__(
)
self.eval_activation = eval_activation

# UPDATE WEIGHT INITIALIZATION TO USE KAIMING
# TODO: put this somewhere better, there might be
# conv layers that aren't follwed by relus?
for _name, layer in self.named_modules():
if isinstance(layer, torch.nn.modules.conv._ConvNd):
torch.nn.init.kaiming_normal_(layer.weight, nonlinearity="relu")

def forward(self, x):
result = self.chain(x)
if not self.training and self.eval_activation is not None:
Expand Down
Loading