bowang-lab/U-Mamba

Residual bloc

eXpensia opened this issue · 0 comments

Hello, to match with the paper, a residual block should :

apply convolution, then normalization, then activation function and then add the residual, two times. thus I would have guess that this should be written as :

def forward(self, x)
        residual = x
        y = self.conv1(x)
        y = self.act1(self.norm1(y))  
        
        y = y + residual
        residual = y
        
        y = self.norm2(self.conv2(y))
    	y = self.act2(y)
        y += residual
        
        return y

which is not the case in the residual block I've found in the repo where the residual is added before the activation of the second block such as :


   def forward(self, x):
        y = self.conv1(x)
        y = self.act1(self.norm1(y))  
        y = self.norm2(self.conv2(y))
        y += x
        return self.act2(y)