【发布时间】:2019-12-09 09:58:25
【问题描述】:
我想在张量的第一个维度中插入两个切片,其中包含两个新值矩阵,我使用的是 tensor_scatter_add 方法,但它给了我一个错误
indices = tf.constant([[0], [2]])
updates = tf.constant([[[5, 5, 5, 5], [6, 6, 6, 6],
[7, 7, 7, 7], [8, 8, 8, 8]],
[[5, 5, 5, 5], [6, 6, 6, 6],
[7, 7, 7, 7], [8, 8, 8, 8]]])
tensor = tf.ones([4, 5, 4])
updated = tf.tensor_scatter_add(tensor, indices, updates)
with tf.Session() as se:
print(ses.run(scatter))
【问题讨论】:
标签: python tensorflow tensor