From cfe9f4c2e3a94ffad5cede4db82874b4df0942bd Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 29 Dec 2022 19:34:40 +0800 Subject: [PATCH] Revert "fix(imperative): fix the split dump problem" This reverts commit 8380af7b464f169b58b1c52791bac0fc983b4f40. GitOrigin-RevId: 062ed1ebb112b55ad52d6d5479c01fd26085dc5c --- imperative/python/src/tensor_utils.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/imperative/python/src/tensor_utils.cpp b/imperative/python/src/tensor_utils.cpp index ebcec0434..268b34d01 100644 --- a/imperative/python/src/tensor_utils.cpp +++ b/imperative/python/src/tensor_utils.cpp @@ -400,6 +400,7 @@ py::object get_res_by_refhdl( ref = py::reinterpret_borrow(ref_hdl); } if (PyObject_TypeCheck(ref.ptr(), py_varnode_type)) { + auto temp = dtype.cast(); ComputingGraph* graph = getattr(ref, "graph").cast(); cg::VarNode* node = getattr(ref, "var").cast(); CompNode cn; @@ -1472,23 +1473,8 @@ py::object _split_cpp( std::to_string(axis) + " cannot be split into " + std::to_string(n_sections) + " sections"); } - if (enable_fastpath(inp_hdl)) { - op = Split::make(axis, n_sections); - p.resize(2); - } else { - size_t n_total_ = n_total.cast(); - for (size_t i = 0; i < n_sections; ++i) { - auto section_size = (n_total_ + n_sections - i - 1) / n_sections; - partitions.append(_Const( - py::int_(section_size), py::cast((mgb::DType)dtype::Int32()), - getattr(inp_hdl, "device"))); - } - op = Split::make(axis, 0); - p.resize(partitions.size() + 2); - for (size_t i = 0; i < partitions.size(); ++i) { - p[i + 2] = partitions[i].ptr(); - } - } + op = Split::make(axis, n_sections); + p.resize(2); } py::object Op = py::cast(op); p[0] = Op.ptr(); -- GitLab