欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

keras的LocallyConnected2D层的现象

时间:2023-08-22
只是先记录下

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

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。