Skip to content

Wrong order of arguments / keyword arguments #2

@LukasHasf

Description

@LukasHasf

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
"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions