【问题标题】:In Tensorflow, how to unravel the flattened indices obtained by tf.nn.max_pool_with_argmax?在 TensorFlow 中,如何解开 tf.nn.max_pool_with_argmax 得到的扁平化索引?
【发布时间】:2016-06-07 14:32:08
【问题描述】:

我遇到一个问题:使用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 中将展平的索引解开回坐标列表?

非常感谢。

【问题讨论】:

    标签: python tensorflow deep-learning


    【解决方案1】:

    我今天遇到了同样的问题,我最终得到了这个解决方案:

    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 位置转发到我的解池方法)

    【讨论】:

    • 酷。你用 tensorflow 实现 Deconvnet。
    • 嗨,你能评论一下它背后的数学吗?你是怎么得到这些表达方式的?
    猜你喜欢
    • 2021-08-22
    • 2018-05-14
    • 2017-03-25
    • 2021-02-03
    • 1970-01-01
    • 2011-12-31
    • 2018-11-07
    • 1970-01-01
    相关资源
    最近更新 更多