两个layer输出相乘用什么接口
cell_decoder_1 = paddle.layer.fc(name='sru_decoder', input = cell_decoder, act=paddle.activation.Linear()) cell_decoder_2 = paddle.layer.fc(name='sru_decoder', input = cell_decoder, act=paddle.activation.Linear())
假设cell_decoder_1为[-1,256],cell_decoder_2为[256,256] cell_decoder_1 *cell_decoder_2 用什么接口实现
如果是点对点乘,用mixed_layer+dotmul_operator
with paddle.layer.mixed(name=name) as output:
output += paddle.layer.dotmul_operator(a= cell_decoder_1, b= cell_decoder_2)
文档: http://www.paddlepaddle.org/docs/develop/api/en/config/layer.html#dotmul-operator
@qingqing01 多谢,您今天帮助我解决了很多问题
@qingqing01 矩阵相乘也是用这个么
矩阵相乘不能用这个。 目前只有fc, 或mixed layer+full_matrix_projection,但这两个都有一个是weight。也不能满足你。
Fluid都是基于op,比较灵活的。
@qingqing01 看来我得将v2全部转化为fluid了,这个转换容易不
@chenbblei 看网络复杂程度,models里有很多已经用Fluid验证过的模型,也可以参考。