MCPcopy Create free account
hub / github.com/Sirwenhao/Deep-Learning-Notes / _DenseBlock

Class _DenseBlock

CV/Pytorch_classification/DenseNet/model.py:61–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 return new_features
60
61class _DenseBlock(nn.ModuleDict):
62 _version=2
63 def __init__(self, num_layers, input_c, bn_size, growth_rate, drop_rate, memory_efficient=False):
64 super(_DenseBlock, self).__init__()
65 for i in range(num_layers):
66 layer = _DenseLayer(input_c + i * growth_rate, growth_rate=growth_rate, bn_size=bn_size,drop_rate=drop_rate, memory_efficient=memory_efficient)
67 self.add_module("denselayer%d" %(i+1), layer)
68
69 def forward(self, init_features):
70 features = [init_features]
71 for name, layer in self.items():
72 new_features = layer(features)
73 features.append(new_features)
74 return torch.cat(features, 1)
75class _Transition(nn.Sequential):
76 def __init__(self, input_c, output_c):
77 super(_Transition, self).__init__()

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected