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])
上一篇:linux内核调试环境


下一篇:spyder python debug时提示错误:Restarting kernel...