【论文复现】关于模型保存大小不同的问题
Created by: ruyijidan
下面两种方式,训练时现存占用都差不多,但是第一种方式保存的模型要比第二种方式小很多,这是为什么呢?
mylayers1 = []
for _ in range(3):
layers = fluid.dygraph.Sequential(Linear(100, 100),
(Linear(100, 100)),
(Linear(100, 100)),
(Linear(100, 10)))
mylayers.append(layers)
for i in range(3):
x = mylayers[i](x)
#################################################################
mylayers2_0 = fluid.dygraph.Sequential(Linear(100, 100),
(Linear(100, 100)),
(Linear(100, 100)),
(Linear(100, 10)))
mylayers2_1 = fluid.dygraph.Sequential(Linear(100, 100),
(Linear(100, 100)),
(Linear(100, 100)),
(Linear(100, 10)))
mylayers2_2 = fluid.dygraph.Sequential(Linear(100, 100),
(Linear(100, 100)),
(Linear(100, 100)),
(Linear(100, 10)))
x = mylayers2_0(x)
x = mylayers2_1(x)
x = mylayers2_2(x)