code_1.py 376 字节
Newer Older
ToTensor's avatar
ToTensor 已提交
1 2 3 4 5 6 7
from keras.models import Sequential # 导入序贯模型
from keras.layers.embeddings import Embedding #导入词嵌入层
from keras.layers import Dense #导入全连接层
from keras.layers import LSTM #导入LSTM层
embedding_vecor_length = 60 # 设定词嵌入向量长度为60
lstm = Sequential() #序贯模型
lstm.add(Embedding(dictionary_size, embedding_vecor_length,