【发布时间】:2019-01-07 04:33:17
【问题描述】:
您好,我是 TensorFlow 新手,我想将 2D 张量连接到 3D 张量。我不知道如何通过利用 TensorFlow 函数来做到这一点。
tensor_3d = [[[1,2], [3,4]], [[5,6], [7,8]]] # shape (2, 2, 2)
tensor_2d = [[10,11], [12,13]] # shape (2, 2)
out: [[[1,2,10,11], [3,4,10,11]], [[5,6,12,13], [7,8,12,13]]] # shape (2, 2, 4)
我会通过使用循环和新的 numpy 数组来使其工作,但这样我就不会使用 TensorFlow 转换。关于如何使这成为可能的任何建议?我看不出像 tf.expand_dims 或 tf.reshape 这样的转换可能对这里有什么帮助......
感谢您分享您的知识。
【问题讨论】:
标签: python numpy tensorflow neural-network