Python 如何将列表列表转换为NumPy数组并获得完整大小?

Python 如何将列表列表转换为NumPy数组并获得完整大小?,python,keras,nltk,Python,Keras,Nltk,当我尝试运行此代码时: model = Sequential() model.add(Embedding(len(set(text_words)), 100,input_length=8555)) model.compile('rmsprop', 'mse') output_array = model.predict(b) 我得到了这个错误: ValueError: Error when checking input: expected embedding_1_input to have sh

当我尝试运行此代码时:

model = Sequential()
model.add(Embedding(len(set(text_words)), 100,input_length=8555))
model.compile('rmsprop', 'mse')
output_array = model.predict(b)
我得到了这个错误:

ValueError: Error when checking input: expected embedding_1_input to have shape (8555,) but got array with shape (1,)
这部分出了什么问题


我正在使用NumPy数组数据。变量
b
是我代码中的NumPy数组数据。

要将列表列表转换为NumPy数组,然后打印其形状和大小:

import numpy as np 

numpy_array = np.array(list_of_lists)
print("shape:", numpy_array.shape," size", numpy_array.size)

Numpy的可能副本对此有一个
展平
方法