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

Function _convert_inputs_cpp

imperative/python/src/tensor_utils.cpp:460–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458}
459
460py::object _convert_inputs_cpp(
461 PyObject* const* args, size_t nargs, py::object dtype, py::object device) {
462 ComputingGraph* graph = nullptr;
463 py::handle typeobj;
464 py::list lis;
465 for (size_t i = 0; i < nargs; ++i) {
466 py::handle h = py::handle(args[i]);
467 lis.append(h);
468 }
469
470 auto convert = [&](py::object value) {
471 if (value.is_none()) {
472 return value;
473 }
474 return _convert_single_value_cpp(value, dtype, device);
475 };
476 for (size_t i = 0; i < lis.size(); ++i) {
477 lis[i] = convert(lis[i]);
478 }
479 return py::reinterpret_steal<py::tuple>(PyList_AsTuple(lis.ptr()));
480}
481
482py::object _astensor1d_cpp(
483 py::handle value, py::handle dtype, py::handle device, py::handle ref) {

Callers 1

tensor_utils.cppFile · 0.85

Calls 5

convertFunction · 0.50
appendMethod · 0.45
sizeMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected