其他分享
首页 > 其他分享> > keras的LocallyConnected2D层的现象

keras的LocallyConnected2D层的现象

作者:互联网

只是先记录下

keras LocallyConnected2D 连续建4层(或者更少),就可能会出现模型编译时间超长,狂占GPU显存的问题。原因没有找到。

input = layers.Input(shape = (window_size, factor_num, 1))

model = layers.LocallyConnected2D(8, kernel_size = (1,1))(input)
model = layers.BatchNormalization(axis=-1, momentum=momentum)(model)  
model = layers.Activation("relu")(model)

model = layers.LocallyConnected2D(8, kernel_size = (1,1))(model)
model = layers.BatchNormalization(axis=-1, momentum=momentum)(model)  
model = layers.Activation("relu")(model)

model = layers.LocallyConnected2D(1, kernel_size = (1,factor_num))(model)
model = layers.BatchNormalization(axis=-1, momentum=momentum)(model)  
model = layers.Activation("relu")(model)
  
model = layers.Reshape((-1,))(model)
model = dense(model,32)
model = layers.Dense(1)(model)

model = Model(inputs = input, outputs = model)

model.compile(loss = "mse", optimizer = opt, metrics = [r_square])

标签:layers,kernel,keras,现象,model,LocallyConnected2D,momentum,size
来源: https://blog.csdn.net/u010048197/article/details/122782509