我有以下网络:
name
这是摘要:
type
我有两个问题:
1- softmax层的输入为:num_values_week
,并且输出具有相同的暗淡!那么在这一步发生了什么?当输入为2D时,softmax激活会赋予时间步长(第二次暗淡)不同的概率或权重,但是这种情况呢?
2-我想在5 days
和inp_features = Input(shape=(segment_number, 10), name='features_input')
flow_features = Bidirectional(GRU(gru_size, activation='tanh', return_sequences=True, name='LSTM1'))(inp_features)
features = Model(inp_features, flow_features)
features.summary()
sent_input = Input(shape=(segment_number, max_seg_len), dtype='float32', name='input_2')
y = Dense(40, name='dense_2')(sent_input)
y = concatenate([inp_features, y], axis=2)
y = Dense((gru_size*2), name='dense_3')(y)
y = Activation('softmax')(y)
y = keras.layers.dot([y, flow_features], axes=[2, 2])
y = Dense(2, activation='softmax', name='final_softmax')(y)
model = Model([inp_features, sent_input], y)
model.summary()
之间做点积,为什么?我假设先前的softmax层对应用在第3个dim(64)上的时间步长(第2个dim,20)给出了不同的权重。因此,我想使用softmax输出矩阵为Bi-LSTM(Layer (type) Output Shape Param #
=================================================================
features_input (InputLayer) (None, 20, 10) 0
_________________________________________________________________
bidirectional_1 (Bidirection (None, 20, 64) 8256
=================================================================
Total params: 8,256
Trainable params: 8,256
Non-trainable params: 0
_________________________________________________________________
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_2 (InputLayer) (None, 20, 400) 0
__________________________________________________________________________________________________
features_input (InputLayer) (None, 20, 10) 0
__________________________________________________________________________________________________
dense_2 (Dense) (None, 20, 40) 16040 input_2[0][0]
__________________________________________________________________________________________________
concatenate_1 (Concatenate) (None, 20, 50) 0 features_input[0][0]
dense_2[0][0]
__________________________________________________________________________________________________
dense_3 (Dense) (None, 20, 64) 3264 concatenate_1[0][0]
__________________________________________________________________________________________________
activation_1 (Activation) (None, 20, 64) 0 dense_3[0][0]
__________________________________________________________________________________________________
bidirectional_1 (Bidirectional) (None, 20, 64) 8256 features_input[0][0]
__________________________________________________________________________________________________
dot_1 (Dot) (None, 20, 20) 0 activation_1[0][0]
bidirectional_1[0][0]
__________________________________________________________________________________________________
final_softmax (Dense) (None, 20, 2) 42 dot_1[0][0]
==================================================================================================
Total params: 27,602
Trainable params: 27,602
Non-trainable params: 0
__________________________________________________________________________________________________
)的输出做“加权平均”。我在两个矩阵上应用了点积(内部积):
(None, 20, 64)
因此,activation_1
匹配bidirectional_1
暗淡。我做的对吗?