keras的LocallyConnected2D层的现象

keras的LocallyConnected2D层的现象,第1张

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])

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5721066.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-18
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存