我有两个张量,get_shape = [?,400]和[?,1176]。我想把它们连成一个大小的张量[?,1576]。
我尝试过concat,但它要求两者都是相同的维度。
怎么做?
答案 0 :(得分:2)
希望您通过批量大小传递相同的输入维度。
import tensorflow as tf
import numpy as np
t1 = tf.placeholder(tf.float32, [None, 400])
t2 = tf.placeholder(tf.float32, [None, 1176])
t3 = tf.concat([t1, t2], axis = 1)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
t3_val = sess.run(t3, feed_dict = {t1: np.ones((300, 400)), t2: np.ones((300, 1176))})
print(t3_val.shape)
# (300, 1576)