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

Function _expand_args

imperative/python/src/tensor_utils.cpp:897–908  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

895}
896
897py::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
910std::tuple<std::vector<int32_t>, bool> tuple2vector(py::object shape) {
911 std::vector<int32_t> shp;

Callers 3

_broadcast_cppFunction · 0.70
_reshape_cppFunction · 0.70
_transpose_cppFunction · 0.70

Calls 3

is_tensorFunction · 0.85
ptrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected