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

Function make_features

CV/Pytorch_classification/VGGNet/model.py:54–65  ·  view source on GitHub ↗
(cfg: list)

Source from the content-addressed store, hash-verified

52
53# 采用写配置文件的方式,将网络对应层的类型及其参数写入到sequential容器中
54def make_features(cfg: list):
55 # 空列表layers用于存放每一层创建的结构
56 layers = []
57 in_channels = 3
58 for v in cfg:
59 if v == "M":
60 layers += [nn.MaxPool2d(kernel_size=2, stride=2)]
61 else:
62 conv2d = nn.Conv2d(in_channels, v, kernel_size=3, padding=1)
63 layers += [conv2d, nn.ReLU(True)]
64 in_channels = v
65 return nn.Sequential(*layers)
66
67
68cfgs = {

Callers 1

vggFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected