Fix cell id

Signed-off-by: zjun <zhangjun0@huawei.com>
This commit is contained in:
zjun 2021-06-24 12:35:47 +08:00
parent 6bd66b3d70
commit d652fb80b2
1 changed files with 8 additions and 2 deletions

View File

@ -163,8 +163,14 @@ std::string GetId(const py::object &obj) {
return prefix;
}
py::object ret = parse::python_adapter::CallPyFn(parse::PYTHON_MOD_PARSE_MODULE, parse::PYTHON_MOD_GET_OBJ_ID, obj);
return py::cast<std::string>(ret);
if (py::isinstance<Cell>(obj)) {
auto cell = py::cast<CellPtr>(obj);
MS_EXCEPTION_IF_NULL(cell);
return std::to_string(reinterpret_cast<size_t>(cell.get()));
} else {
py::object ret = parse::python_adapter::CallPyFn(parse::PYTHON_MOD_PARSE_MODULE, parse::PYTHON_MOD_GET_OBJ_ID, obj);
return py::cast<std::string>(ret);
}
}
std::map<SignatureEnumDType, std::vector<size_t>> GetTypeIndex(const std::vector<SignatureEnumDType> &dtypes) {