請問用x=Dense()(Inputs), 和Dense(units, input_dim, ....)的差別?
2019/12/11 下午 07:02
電腦視覺深度學習討論版
Liaw Jiun
觀看數:7
回答數:1
收藏數:0
網路查了一下, 通常都是model.add(Dense(32, input_shape=(16,)))
請問用x=Dense()(Inputs), 和Dense(units, input_dim, ....)的差別是???
回答列表
-
2019/12/11 下午 07:27楊哲寧贊同數:0不贊同數:0留言數:0
您好,兩種方式皆可以堆疊NN層,model.add的方式本身就有順序性,因此不需要指定輸入資訊,然而在第一層時需要指定輸入尺寸,而像是x=Dense()(Inputs)這種方式,必須指定上一層輸入特徵,並且在最後利用keras.models.Model 的API將model打包:
inputs = Input(shape=(784,))
x=Dense(288)(inputs)
model = Model(inputs=inputs, outputs=x)