keras Dense 层

文档地址:https://keras.io/layers/core/#dense

keras.layers.Dense(units, activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None)

Dense是这样的操作: 

例子:

# as first layer in a sequential model:
model = Sequential()
model.add(Dense(32, input_shape=(16,)))
# now the model will take as input arrays of shape (*, 16)
# and output arrays of shape (*, 32)

# after the first layer, you don't need to specify
# the size of the input anymore:
model.add(Dense(32))

参数说明:

  • units 一个正整数,表示输出的维度
  • activation 激活函数,如果不定义,则a(x)=x
  • use_bias 这一层是否加bias
  • kernel_initializer kernel的初始化器
  • bias_initializer 偏置的初始化器
  • kernerl_regularizer 用于kernel 的正则化函数
  • bias_regularizer 用于偏置的正则化函数
  • activity_regularizer 用于本层输出的正则化函数
  • kernel_constraint 用于kernel权重的约束函数
  • bias_constraint 用于偏置向量的约束函数
原文地址:https://www.cnblogs.com/superxuezhazha/p/10975443.html