MCPcopy Index your code
hub / github.com/pytorch/pytorch / MLP

Function MLP

caffe2/experiments/python/convnet_benchmarks.py:90–112  ·  view source on GitHub ↗
(order)

Source from the content-addressed store, hash-verified

88
89
90def MLP(order):
91 model = cnn.CNNModelHelper()
92 d = 256
93 depth = 20
94 width = 3
95 for i in range(depth):
96 for j in range(width):
97 current = "fc_{}_{}".format(i, j) if i > 0 else "data"
98 next_ = "fc_{}_{}".format(i + 1, j)
99 model.FC(
100 current, next_,
101 dim_in=d, dim_out=d,
102 weight_init=model.XavierInit,
103 bias_init=model.XavierInit)
104 model.Sum(["fc_{}_{}".format(depth, j)
105 for j in range(width)], ["sum"])
106 model.FC("sum", "last",
107 dim_in=d, dim_out=1000,
108 weight_init=model.XavierInit,
109 bias_init=model.XavierInit)
110 xent = model.LabelCrossEntropy(["last", "label"], "xent")
111 model.AveragedLoss(xent, "loss")
112 return model, d
113
114
115def AlexNet(order):

Callers

nothing calls this directly

Calls 4

FCMethod · 0.95
SumMethod · 0.95
rangeFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected