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

Function subtensor_fastpath

imperative/python/src/tensor_utils.cpp:942–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

940}
941
942bool subtensor_fastpath(py::handle inp_hdl, py::tuple tuple_val) {
943 bool use_fastpath = true;
944 for (size_t i = 0; i < tuple_val.size(); ++i) {
945 PyObject* obj = tuple_val[i].ptr();
946 if ((!is_scalar(obj) && !PySlice_Check(obj) && obj != Py_Ellipsis &&
947 obj != Py_None) ||
948 (PyObject_TypeCheck(obj, py_varnode_type))) {
949 use_fastpath = false;
950 break;
951 }
952 }
953 return use_fastpath && enable_fastpath(inp_hdl);
954}
955
956py::object _broadcast_cpp(py::handle input, py::handle args) {
957 py::object shape = _expand_args(args);

Callers 1

_getitem_cppFunction · 0.85

Calls 4

is_scalarFunction · 0.85
enable_fastpathFunction · 0.85
sizeMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected