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是這樣的操做: spa

例子:code

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

參數說明:orm

  • 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 用於偏置向量的約束函數
相關文章
相關標籤/搜索