ValueError: Dimensions must be equal, but are 16 and 28 for 'seq2seq/decoder/train/decoder

ValueError: Dimensions must be equal, but are 16 and 28 for 'seq2seq/decoder/train/decoder/while/BasicDecoderStep/lstm_cell/MatMul_4' (op: 'MatMul') with input shapes: [2,16], [28,40]

运行tensorflow代码出错,原因是把tf.contrib.seq2seq.BasicDecoder这个函数的cell类搞错了,因为之前已经对decoder_cell这个类进行了重写,所以这里的cell类也需要改变,但是这个错误发生的原因也有很多,这里是由于类的重写导致前后类不一致,

self.decoder_cell = tf.nn.rnn_cell.LSTMCell(_num_units)

self.decoder_cell = tf.nn.rnn_cell.LSTMCell(_num_units)
with tf.variable_scope("MC"):
      mc_cell = NewMTAWrapper(self.decoder_cell, topic_embedded,self.history_memory,
            self.v, self.uf, self.query_layer,           
            self.memory_layer,ex_memory=self.memory,mask=masks)
      rollout_decoder_MC = tf.contrib.seq2seq.BasicDecoder(
                        cell=self.decoder_cell,  #should be mc_cell
                        helper=helper_MC,
                        initial_state=initial_state_MC,
                        output_layer=self.output_layer

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值