【发布时间】:2018-05-15 22:00:59
【问题描述】:
假设我在[M, 1] 中有一个2D-Tensor T,例如
T = tf.expand_dims([A1,
B1,
C1,
A2,
B2,
C2], 1)
我想像这样重塑它:
T_reshp = [[[A1], [A2]]
[[B1], [B2]]
[[C1], [C2]]]
我提前知道M和N(每组张量的个数)。此外,让t_reshp.shape[0] = M/N = P 在我尝试过使用tf.reshape
T_reshp = tf.reshape(T, [P, N, 1])
但是,我最终得到:
T_reshp = [[[A1], [B1]]
[[C1], [A2]]
[[B2], [C2]]]
我可以使用切片或重塑操作来做到这一点吗?
【问题讨论】:
标签: python tensorflow slice reshape