Python 使用tf.nn.u查找多个列

Python 使用tf.nn.u查找多个列,python,tensorflow,lstm,embedding-lookup,Python,Tensorflow,Lstm,Embedding Lookup,我现在用tensorflow制作预测模型(lstm)有一个问题。 我尝试将嵌入查找与多个分类列一起使用。 这是我的数据(形状[100,12,16]) 对于预测,每行都有多个特性,我将这些特性更改为分类数据(0、1、2…)。然后,我想为每列使用嵌入层,然后使用concat作为LSTM的输入数据。 如何使用嵌入层和concat 这是我的密码 def get_var(self, name='', shape=None, dtype=tf.float32): return tf.get_vari

我现在用tensorflow制作预测模型(lstm)有一个问题。 我尝试将嵌入查找与多个分类列一起使用。 这是我的数据(形状[100,12,16])

对于预测,每行都有多个特性,我将这些特性更改为分类数据(0、1、2…)。然后,我想为每列使用嵌入层,然后使用concat作为LSTM的输入数据。 如何使用嵌入层和concat

这是我的密码

def get_var(self, name='', shape=None, dtype=tf.float32):
    return tf.get_variable(name, shape, dtype=dtype, initializer=self.initializer)
def get_embedding(self, data='', name='', shape=[], dtype=tf.float32):
    return tf.nn.embedding_lookup(self.get_var(name=name, shape=shape), data)


emb_concat = self.get_embedding(tf.cast(data[:,:, 0], 'int32'), name='emb_ap2id'+type, shape=[3, 2])

emb = self.get_embedding(tf.cast(data[:,:, 1], 'int32'), name='emb_month'+type, shape=[12, 11])
emb_concat = tf.concat(emb_concat, emb, axis=2)
它不工作,我得到一个错误消息


我如何才能正确地执行此操作?请让我知道,请包括您收到的错误消息。这会让你更容易理解你的问题。哦,我已经解决了。我在tf.concat中没有使用“()”。thx~
def get_var(self, name='', shape=None, dtype=tf.float32):
    return tf.get_variable(name, shape, dtype=dtype, initializer=self.initializer)
def get_embedding(self, data='', name='', shape=[], dtype=tf.float32):
    return tf.nn.embedding_lookup(self.get_var(name=name, shape=shape), data)


emb_concat = self.get_embedding(tf.cast(data[:,:, 0], 'int32'), name='emb_ap2id'+type, shape=[3, 2])

emb = self.get_embedding(tf.cast(data[:,:, 1], 'int32'), name='emb_month'+type, shape=[12, 11])
emb_concat = tf.concat(emb_concat, emb, axis=2)