def build_words2color_model(max_tokens, dim):
"""Build a model that learns to generate colors from words.
:param max_tokens:
:param dim:
:return:
"""
model = Sequential()
model.add(Conv1D(128, 1, input_shape = (max_tokens, dim), activation = "tanh"))
model.add(GlobalMaxPooling1D())
model.add(Dropout(0.5))
model.add(Dense(3))
model.compile(loss = "mse", optimizer = "sgd")
return model
评论列表
文章目录