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

Wrong order of arguments / keyword arguments #2

Open
LukasHasf opened this issue May 7, 2022 · 0 comments
Open

Wrong order of arguments / keyword arguments #2

LukasHasf opened this issue May 7, 2022 · 0 comments

Comments

@LukasHasf
Copy link

Hello,
in unet.py you create ConvBlock-objects with (for example) this call:
self.conv1 = ConvBlock(n_channel_in, 32, residual, activation)

But the constructor of ConvBlock is __init__(self, in_channels, out_channels, dropout=False, norm='batch', residual=True, activation='leakyrelu', transpose=False), resulting in self.dropout being assigned to residual and self.norm being set to activation.

You probably wanted to call it like this:
self.conv1 = ConvBlock(n_channel_in, 32, residual=residual, activation=activation) and so on.

Minimal example:

class ConvBlock():
    def __init__(self, in_channels, out_channels, dropout=False, norm='batch',
                 residual=True, activation='leakyrelu', transpose=False):
        self.dropout = dropout
        self.residual = residual
        self.activation = activation
        self.transpose = transpose
        self.norm = norm
    
    def printme(self):
        print('Dropout: ', self.dropout)
        print('Residual: ', self.residual)
        print('Activation: ', self.activation)
        print('Transpose: ', self.transpose)
        print('Norm: ', self.norm)

residual = True
activation = 'relu'
c = ConvBlock(32, 64, residual, activation)
c.printme()
"""Dropout:  True
Residual:  True
Activation:  leakyrelu
Transpose:  False
Norm:  relu
"""

c2 = ConvBlock(32, 64, residual=residual, activation=activation)
c2.printme()
"""
Dropout:  False
Residual:  True
Activation:  relu
Transpose:  False
Norm:  batch
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant