• tf.argmax(array, axis)


    tf.argmax(array, axis)

    返回值,最大值的索引,axis取0或者1.

    test = np.array([[1, 2, 3], [2, 3, 4], [5, 4, 3], [8, 7, 2]])
    np.argmax(test, 0)   #输出:array([3, 3, 1]
    np.argmax(test, 1)   #输出:array([2, 2, 0, 0]

    在axis为1的时候,为横向比较。

    test = np.array([[1, 2, 3], [2, 3, 4], [5, 4, 3], [8, 7, 2]])
                  max     max  max,index=0 
                index is 2 index is2      max.index=0
    np.argmax(test, 1)   #输出:array([2, 2, 0, 0]

    在axis为0的时候是,纵向比较。

                test = np.array([[1, 2, 3],
                                 [2, 3, 4],  max, index is 1
                                 [5, 4, 3], 
                     max, index is 3 [8, 7, 2]])            
                            max,index=3                         
    np.argmax(test, 0)    #输出:array([3, 3, 1]

    参考这里:https://blog.csdn.net/qq575379110/article/details/70538051

  • 相关阅读:
    vim常用命令
    转:CRF++总结1
    转:CRF++总结2
    并查集算法程序
    CRF++使用小结(转)
    并查集算法程序
    C#winform 画图
    转:字符识别
    转:A Survey On Relation Extraction
    转:生产计划问题
  • 原文地址:https://www.cnblogs.com/smartmsl/p/8821272.html
Copyright © 2020-2023  润新知