简体   繁体   English

Tensorflow:沿轴的堆叠(m,n,k,p)和(m,n,1,p)张量= 2

[英]Tensorflow: stack (m, n, k, p) and (m, n, 1, p) tensors along the axis=2

I have to stack (m, n, k, p) and (m, n, 1, p) tensors along the axis=2. 我必须沿轴= 2堆叠(m,n,k,p)和(m,n,1,p)张量。

tf.pack can only manage tensors of the same shape. tf.pack只能管理相同形状的张量。

I've tried to use tf.unpack but it also doesn't work. 我尝试使用tf.unpack但它也不起作用。

What I believe you are trying to do is called tf.concat : 我相信您要尝试做的就是称为tf.concat

a = tf.zeros([3,4,10,5])
b = tf.zeros([3,4,1,5])
c = tf.concat(2, [a,b])

c.get_shape()
Out: TensorShape([Dimension(3), Dimension(4), Dimension(11), Dimension(5)])

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 numpy矩阵乘法nxm * mxp = nxp - numpy Matrix Multiplication n x m * m x p = n x p 如何沿轴 0 连接 tensorflow 个张量,同时保留其他 n>0 维度的形状 - How do you concatenate tensorflow tensors along axis 0 while preserving the shape of the other n>0 dimensions numpy:如何将(N,)维向量插入(N,M,D)维数组作为沿D轴的新元素? (N,M,D + 1) - Numpy: how to insert an (N,) dimensional vector to an (N, M, D) dimensional array as new elements along the D axis? (N, M, D+1) 将具有形状(M,N,P)阵列的numpy int数组有效转换为具有(N,P)形状的2D对象数组 - Efficient converting of numpy int array with shape (M, N, P) array to 2D object array with (N, P) shape 给定p,k的概率胜出n。 - Probability of k wins out of n, given p? TensorFlow串联/堆叠N张量交错最后一个维度 - TensorFlow concatenate/stack N tensors interleaving last dimensions 将行格式化为向量,如何将reduceByKey(list(n_1,m​​_1)...(n_k,m_k))还原为(n_1 ... n_k)(m_1 ... m_k) - Format row into vector, how to reduceByKey (list(n_1, m_1)…(n_k, m_k)) to (n_1…n_k) (m_1…m_k)) 块状(n,1,m)至(n,m) - Numpy (n, 1, m) to (n,m) 如何从numpy中的ap * q大矩阵获取m * n子矩阵 - How to obtain an m*n sub-matrix from a p*q larger matrix in numpy 以有效的方式用大小为 (k,m) 的 n 矩阵构建大小为 (n*k, m) 的数组 - Build array with size (n*k, m) with n matrix of size (k,m) with an efficient way
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM