提交 6f09b0eb 编写于 作者: M Megvii Engine Team

chore(trace): add more error message for tensor invalid

GitOrigin-RevId: 762334218bb7e52c4be4c8eb66319df6679c4b27
上级 ef04619c
...@@ -672,7 +672,17 @@ PyObject* TensorWrapper::format() { ...@@ -672,7 +672,17 @@ PyObject* TensorWrapper::format() {
PyObject* TensorWrapper::numpy() { PyObject* TensorWrapper::numpy() {
auto hv = m_tensor->numpy(); auto hv = m_tensor->numpy();
if (!hv) { if (!hv) {
PyErr_SetString(PyExc_ValueError, "tensor invalid"); if (TransformationManager::get_instance()
.segments[TransformationManager::Segment::Eval]
.size() > 1) {
PyErr_SetString(
PyExc_ValueError,
"tensor invalid, can not infer value of this tensor under "
"trace(symbolic=True). You can try to use trace(symbolic=False) to "
"avoid this issue.");
} else {
PyErr_SetString(PyExc_ValueError, "tensor invalid");
}
return nullptr; return nullptr;
} }
auto arr = py::reinterpret_steal<py::array>( auto arr = py::reinterpret_steal<py::array>(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册