在Tensorflow中,如何解开tf.nn.max_pool_with_argmax得到的扁平化指数?
In Tensorflow, how to unravel the flattened indices obtained by tf.nn.max_pool_with_argmax?
我遇到一个问题:在我使用tf.nn.max_pool_with_argmax之后,我得到了索引,即
argmax: A Tensor of type Targmax. 4-D. The flattened indices of the max values chosen for each output.
如何在 Tensorflow 中将展平的索引解散回坐标列表?
非常感谢。
我今天遇到了同样的问题,最后得到了这个解决方案:
def unravel_argmax(argmax, shape):
output_list = []
output_list.append(argmax // (shape[2] * shape[3]))
output_list.append(argmax % (shape[2] * shape[3]) // shape[3])
return tf.pack(output_list)
这是 ipython 笔记本中的 usage example(我用它来将池化 argmax 位置转发到我的解池化方法)
我遇到一个问题:在我使用tf.nn.max_pool_with_argmax之后,我得到了索引,即
argmax: A Tensor of type Targmax. 4-D. The flattened indices of the max values chosen for each output.
如何在 Tensorflow 中将展平的索引解散回坐标列表?
非常感谢。
我今天遇到了同样的问题,最后得到了这个解决方案:
def unravel_argmax(argmax, shape):
output_list = []
output_list.append(argmax // (shape[2] * shape[3]))
output_list.append(argmax % (shape[2] * shape[3]) // shape[3])
return tf.pack(output_list)
这是 ipython 笔记本中的 usage example(我用它来将池化 argmax 位置转发到我的解池化方法)