self.blocks = nn.Sequential( *([basic_block(input_feature_channels, output_feature_channels, self.conv_op, self.conv_kwargs_first_conv, self.norm_op, self.norm_op_kwargs, self.dropout_op, self.dropout_op_kwargs, self.nonlin, self.nonlin_kwargs)] + [basic_block(output_feature_channels...
In the comments,Gary pointed outthat the example given above is actually more of a ‘code smell’ than a best practice for writing code primarily because a lot of the deep nesting can be refactored into their own functions that result in significantly easier code to read and maintain. As s...