dome272 / Diffusion-Models-pytorch

Pytorch implementation of Diffusion Models (https://arxiv.org/pdf/2006.11239.pdf)
Apache License 2.0
1.11k stars 256 forks source link

qn regarding DoubleConv #5

Closed Qbiwan closed 1 year ago

Qbiwan commented 1 year ago

Any reason why there is no gelu in the else clause (when there is no self.residual)? a bit puzzled.

class DoubleConv(nn.Module):

    def forward(self, x):
        if self.residual:
            return F.gelu(x + self.double_conv(x))
        else:
            return self.double_conv(x)
dome272 commented 1 year ago

You are right, you could just add. I didnt experience any problems during training and just went with this architecture. Feel free to try it out if it changes something :)

Qbiwan commented 1 year ago

Cool! Btw, love your youtubes, watched them quite a few times :thumbsup: :thumbsup: :thumbsup:

AdamWojtczak commented 1 year ago

Hi @Qbiwan, So would this code look like this after adding GELU?

`class DoubleConv(nn.Module):

def forward(self, x):
    if self.residual:
        return F.gelu(x + self.double_conv(x))
    else:
        return  F.gelu(self.double_conv(x))`