MCPcopy Create free account
hub / github.com/numpy/numpy / array_argmax

Function array_argmax

numpy/core/src/multiarray/methods.c:286–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286static PyObject *
287array_argmax(PyArrayObject *self,
288 PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames)
289{
290 int axis = NPY_MAXDIMS;
291 PyArrayObject *out = NULL;
292 npy_bool keepdims = NPY_FALSE;
293 NPY_PREPARE_ARGPARSER;
294
295 if (npy_parse_arguments("argmax", args, len_args, kwnames,
296 "|axis", &PyArray_AxisConverter, &axis,
297 "|out", &PyArray_OutputConverter, &out,
298 "$keepdims", &PyArray_BoolConverter, &keepdims,
299 NULL, NULL, NULL) < 0) {
300 return NULL;
301 }
302
303 PyObject *ret = _PyArray_ArgMaxWithKeepdims(self, axis, out, keepdims);
304
305 /* this matches the unpacking behavior of ufuncs */
306 if (out == NULL) {
307 return PyArray_Return((PyArrayObject *)ret);
308 }
309 else {
310 return ret;
311 }
312}
313
314static PyObject *
315array_argmin(PyArrayObject *self,

Callers

nothing calls this directly

Calls 2

PyArray_ReturnFunction · 0.85

Tested by

no test coverage detected