MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / is_bool_list

Function is_bool_list

imperative/python/src/tensor_utils.cpp:257–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257bool is_bool_list(PyObject* arg) {
258 if (!PyList_Check(arg)) {
259 return false;
260 }
261 size_t sz = PyList_Size(arg);
262 if (!sz) {
263 return false;
264 }
265 for (size_t i = 0; i < sz; ++i) {
266 PyObject* handle = PyList_GetItem(arg, i);
267 if (!PyBool_Check(handle)) {
268 return false;
269 }
270 }
271 return true;
272}
273
274bool is_bool_dtype(PyObject* args) {
275 if (!PyObject_HasAttrString(args, "dtype"))

Callers 1

_get_indexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected