class _DenseBlock(nn.Sequential):
def __init__(self, num_layers, num_input_features, bn_size, growth_rate,
             drop_rate):
    super(_DenseBlock, self).__init__()
    for i in range(num_layers):
        layer = _DenseLayer(num_input_features + i * growth_rate,
                            growth_rate, bn_size, drop_rate)
        self.add_module('denselayer%d' % (i + 1), layer)