Open koncle opened 5 years ago
Meet the similar problem. Value Error: setting an array element with a sequence.
TypeError: only size-1 arrays can be converted to Python scalars The above exception was the direct cause of the following exception: Traceback (most recent call last): File "D:\Anaconda3\envs\text_classification\lib\contextlib.py", line 99, in exit self.gen.throw(type, value, traceback) File "D:\Anaconda3\envs\text_classification\lib\site-packages\tensorflow\python\framework\ops.py", line 5253, in get_controller yield g File "D:/company/pycharm/text_classification/a02_TextCNN/p7_TextCNN_train.py", line 84, in main assign_pretrained_word_embedding(sess, index2word, vocab_size, textCNN, FLAGS.word2vec_model_path) File "D:/company/pycharm/text_classification/a02_TextCNN/p7_TextCNN_train.py", line 236, in assign_pretrained_word_embedding word_embedding = tf.constant(word_embedding_final, dtype=tf.float64,shape=(11982,)) # convert to tensor File "D:\Anaconda3\envs\text_classification\lib\site-packages\tensorflow\python\framework\constant_op.py", line 179, in constant_v1 allow_broadcast=False) File "D:\Anaconda3\envs\text_classification\lib\site-packages\tensorflow\python\framework\constant_op.py", line 283, in _constant_impl allow_broadcast=allow_broadcast)) File "D:\Anaconda3\envs\text_classification\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 440, in make_tensor_proto nparray = values.astype(dtype.as_numpy_dtype) ValueError: setting an array element with a sequence.
In p7_TextCNN_train.py :
The word_embedding_2dlist[1] doesn't get any embedding. The loop should begin from 1 to vocab_size.