问题描述
我有 2 个输入:a:一个 5D 数组存储图像(batchsize * timestep* length * width * channel(3)),i:一个 5D 数组存储最后一个通道的 2D 坐标(batchsize * timestep* length * width * 坐标(2)) 输出是一个 5D 数组存储图像根据 i(batchsize * timestep* length * width * channel(3)) 从 a 中选择每个像素 类似的东西:
out = tf.zeros([b,t,l,w,c])
for h in range(b):
for j in range(t):
for k in range(l):
for m in range(w):
out[h,j,k,m,:]=a[h,i[h,i,m][0],m][1],:]
我正在尝试使用 tf.gather_nd
但它没有用:
a = tf.ones([32,5,6,3])
i = tf.ones([32,2,1],dtype='int64')
tf.gather_nd(a,i).shape
TensorShape([32,3])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)