Skip to content

fix preactivation in BigGAN-deep #81

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 5 additions & 2 deletions BigGANdeep.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ def shortcut(self, x):

def forward(self, x):
# 1x1 bottleneck conv
h = self.conv1(F.relu(x))
h = x
if self.preactivation:
h = F.relu(h)
h = self.conv1(h)
# 3x3 convs
h = self.conv2(self.activation(h))
h = self.conv3(self.activation(h))
Expand Down Expand Up @@ -420,7 +423,7 @@ def __init__(self, D_ch=64, D_wide=True, D_depth=2, resolution=128,
which_conv=self.which_conv,
wide=self.D_wide,
activation=self.activation,
preactivation=True,
preactivation=index > 0 or d_index > 0,
downsample=(nn.AvgPool2d(2) if self.arch['downsample'][index] and d_index==0 else None))
for d_index in range(self.D_depth)]]
# If attention on this block, attach it to the end
Expand Down