美文网首页
argmax()函数详解

argmax()函数详解

作者: 猴子喜 | 来源:发表于2018-12-06 15:20 被阅读0次

argmax()函数详解

例子1:

>>> a=np.arange(12).reshape(2,6)
>>> a
array([[ 0,  1,  2,  3,  4,  5],
       [ 6,  7,  8,  9, 10, 11]])
>>> np.argmax(a,1)
array([5, 5])   #第五个数数值最大

例子2:

>>> a=np.arange(24).reshape(2,3,4)
>>> a
array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7],
        [ 8,  9, 10, 11]],

       [[12, 13, 14, 15],
        [16, 17, 18, 19],
        [20, 21, 22, 23]]])
>>> np.argmax(a,1)
array([[2, 2, 2, 2],
       [2, 2, 2, 2]])
>>> np.argmax(a,1).shape
(2, 4)

[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]] 中[ 8, 9, 10, 11]是最大的

>>> np.argmax(a,2)
array([[3, 3, 3],      
       [3, 3, 3]])
>>> np.argmax(a,2).shape
(2, 3)

[ 0, 1, 2, 3]中[3]是最大的

相关文章

  • argmax()函数详解

    argmax()函数详解 例子1: 例子2: [[ 0, 1, 2, 3],[ 4, 5, 6, 7]...

  • Pytorch中torch.argmax()函数解析

    一. torch.argmax()函数解析 1. 官网链接 torch.argmax()[https://pyto...

  • C/C++的30个冷知识

    数据格式详解 输入输出函数详解 字符串处理函数详解 内存函数详解 类详解 数据格式详解 2^8=256(同样是一个...

  • numpy的argmax用法(转)

    原链接: (Python)numpy的argmax用法 一维数组 argmax返回的是最大数的索引.argmax有...

  • TensorFlow(5)常用函数

    tf.argmax(actv,1) tf.argmax(input, axis=None, name=None, ...

  • Numpy常用函数用法大全

    Numpy常用函数用法大全目录 Aarray 创建一个np数组arange 返回指定范围内的数组argmax 返回...

  • Numpy

    argmax用法 还是从一维数组出发.看下面的例子: argmax返回的是最大数的索引.argmax有一个参数ax...

  • tf.argmax

    文件 math_ops.py 函数定义 参数 返回 案例 输出结果解释首先,argmax返回的是索引值,返回每一行...

  • Tensorflow——tf.argmax()解析

    简介 tf.argmax就是返回最大的那个数值所在的下标。 定义如下:def argmax(self, axis=...

  • 【图像处理】OpenCV系列三十二 --- polylines、

    一、polylines()函数详解 1、函数原型 2、函数功能绘制几条多边形曲线; 3、参数详解 第一个参数,In...

网友评论

      本文标题:argmax()函数详解

      本文链接:https://www.haomeiwen.com/subject/lysocqtx.html