请用neon帮我实现一个argmax函数
import numpy as np
def neon_argmax(arr): arr = np.array(arr) max_value = np.max(arr) argmax_index = np.where(arr == max_value) return argmax_index[0][0] # return the first index if multiple indices have the same max value
Example usage
arr = [1, 3, 2, 5, 4] result = neon_argmax(arr) print(result) # Output: 3
原文地址: https://www.cveoy.top/t/topic/hJio 著作权归作者所有。请勿转载和采集!