| 1524 | } |
| 1525 | |
| 1526 | std::vector<int32_t> list2vector(py::handle li) { |
| 1527 | std::vector<int32_t> axis; |
| 1528 | if (is_py_sequence(li)) { |
| 1529 | py::list tmp_list = py::reinterpret_steal<py::list>(PySequence_List(li.ptr())); |
| 1530 | for (size_t i = 0; i < tmp_list.size(); ++i) { |
| 1531 | axis.push_back(tmp_list[i].attr("__int__")().cast<int32_t>()); |
| 1532 | } |
| 1533 | } else { |
| 1534 | axis.push_back(getattr(li, "__int__")().cast<int32_t>()); |
| 1535 | } |
| 1536 | return axis; |
| 1537 | } |
| 1538 | |
| 1539 | py::object _expand_dims_cpp(py::handle inp_hdl, py::handle axis_hdl) { |
| 1540 | std::vector<int32_t> axis = list2vector(axis_hdl); |
no test coverage detected