如何在张量流中对张量执行 np.append() 类型的操作?
How to perform np.append() type operation on tensors in tensorflow?
我想在现有张量中添加一个新张量作为最后一列。使用 numpy 我可以使用 np.append()
,但我不确定如何在 tensorflow 中对张量执行此操作。有什么建议吗?
>> a = np.array([[1,2], [3,4], [5,6]])
>> b = np.array([[9], [99], [999]])
>> np.append(a, b, axis=1)
array([[ 1, 2, 9],
[ 3, 4, 99],
[ 5, 6, 999]])
在张量流中..?
>> x = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], tf.float32)
>> y = tf.constant([[9.0], [99.0], [999.0]], tf.float32)
>> ???
已解决:tf.concat((x, y), 轴=-1)
我想在现有张量中添加一个新张量作为最后一列。使用 numpy 我可以使用 np.append()
,但我不确定如何在 tensorflow 中对张量执行此操作。有什么建议吗?
>> a = np.array([[1,2], [3,4], [5,6]])
>> b = np.array([[9], [99], [999]])
>> np.append(a, b, axis=1)
array([[ 1, 2, 9],
[ 3, 4, 99],
[ 5, 6, 999]])
在张量流中..?
>> x = tf.constant([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]], tf.float32)
>> y = tf.constant([[9.0], [99.0], [999.0]], tf.float32)
>> ???
已解决:tf.concat((x, y), 轴=-1)