| 895 | } |
| 896 | |
| 897 | py::object _expand_args(py::handle args) { |
| 898 | if (!PyTuple_Check(args.ptr())) { |
| 899 | return py::reinterpret_borrow<py::object>(args); |
| 900 | } |
| 901 | py::tuple args_tup = py::reinterpret_borrow<py::tuple>(args.ptr()); |
| 902 | if (args_tup.size() == 1 && |
| 903 | (PySequence_Check(args_tup[0].ptr()) || is_tensor(args_tup[0].ptr()))) { |
| 904 | return py::reinterpret_borrow<py::object>(args_tup[0]); |
| 905 | } else { |
| 906 | return py::reinterpret_steal<py::list>(PySequence_List(args_tup.ptr())); |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | std::tuple<std::vector<int32_t>, bool> tuple2vector(py::object shape) { |
| 911 | std::vector<int32_t> shp; |
no test coverage detected