我有两个张量,get_shape = [?, 400] 和 [?, 1176]。我想将它们连接成一个大小为 [?, 1576] 的张量。
我试过 concat,但它要求两者的维度相同。
怎么做?
希望您通过批量大小传递相同维度的输入。
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)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3504 次 |
| 最近记录: |