NELSONZHAO / zhihu

This repo contains the source code in my personal column (https://zhuanlan.zhihu.com/zhaoyeyu), implemented using Python 3.6. Including Natural Language Processing and Computer Vision projects, such as text generation, machine translation, deep convolution GAN and other actual combat code.
https://zhuanlan.zhihu.com/zhaoyeyu
3.5k stars 2.14k forks source link

machine_translation_seq2seq 运行报错 #29

Open ssnvxia opened 5 years ago

ssnvxia commented 5 years ago

您好,运行down下来的代码,没有改动,运行到 with tf.Session(graph=train_graph) as sess: sess.run(tf.global_variables_initializer()) 这一个代码块的时候程序报错: Dimensions of inputs should match: shape[0] = [128,1] vs. shape[1] = [4 7,24] 目测是因为source和target的维度不一致导致的,我检查了好几编也没有弄清楚哪里出了问题。还请赐教

ssnvxia commented 5 years ago

上一个问题解决了,我发现了一个新的问题,代码中source_sentence和target_sentence的最大长度分别是20和25,程序可以正常运行,可是这个数值我改成其他的都会报错。。。真的是要愁死小白了

A6Matrix commented 5 years ago

请教第一个问题是怎么解决的

ssnvxia commented 5 years ago

维度必须一致。。。改一下就好了