import cupy import colorsys from scipy.stats import mode import numpy as np a = np.asarray([[134,452,532],[123,531,532],[111,553,742]]) print(mode(a).mode[0])