numpy max vs amax vs maximum

后端 未结 4 1549
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 19:31

numpy has three different functions which seem like they can be used for the same things --- except that numpy.maximum can only be used element-wise, w

4条回答
  •  旧时难觅i
    2020-11-28 19:51

    You've already stated why np.maximum is different - it returns an array that is the element-wise maximum between two arrays.

    As for np.amax and np.max: they both call the same function - np.max is just an alias for np.amax, and they compute the maximum of all elements in an array, or along an axis of an array.

    In [1]: import numpy as np
    
    In [2]: np.amax
    Out[2]: 
    
    In [3]: np.max
    Out[3]: 
    

提交回复
热议问题