| 458 | } |
| 459 | |
| 460 | py::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 | |
| 482 | py::object _astensor1d_cpp( |
| 483 | py::handle value, py::handle dtype, py::handle device, py::handle ref) { |
no test coverage detected