关于几个全连接层的含义
来源:9-16 构建解码器(5)

xixixi3432
2019-03-17
1. if self.use_residual:
self.encoder_inputs_embedded = \
layers.dense(self.encoder_inputs_embedded,
self.hidden_units,
use_bias=False,
name='encoder_residual_projection')
老师,我不懂为什么您在选择使用residual时候要构建一个全连接层,用residual时候直接用tf.contrib.rnn.ResidualWrapper( )不就好了吗?这个返回cell类型。
-
def cell_input_fn(inputs, attention):
""“根据attn_input_feeding属性来判断是否在attention计算前进行一次投影计算
”""
if not self.use_residual:
return array_ops.concat([inputs, attention], -1)attn_projection = layers.Dense(self.hidden_units, dtype=tf.float32, use_bias=False, name='attention_cell_input_fn') return attn_projection(array_ops.concat([inputs, attention], -1))
然后我也不懂这个函数的意思,麻烦老师讲一下呀,,,
写回答
1回答
-
Mr_Ricky
2019-04-29
一般来讲,我们在训练残差的时候,会在后面加一个全连接层,为了方便最后的统一输出,下面的函数实际上就是一个映射,你可以看下attention的论文有讲这块的内容。
00
相似问题