提交 41b9db85 编写于 作者: M Megvii Engine Team

fix(mgb): make error infomation of advanced indexing out of bound more readable

GitOrigin-RevId: 69e6f32e7e071e06bb52ce551e7a3efbeeb34912
上级 eb512b62
......@@ -36,8 +36,8 @@ __global__ void kgen_offset_base(GenOffsetBaseParam<nidx, idx_ndim> param) {
set_async_error_info(
param.error_info, param.error_tracker,
"invalid advanced indexing: "
"indexer=%d idx=%d shape=%d",
i, data_idx, param.data_shape[i]);
"input index %d is out of bounds for axis %d with size %d",
data_idx, i, param.data_shape[i]);
data_idx = 0;
}
// calculate offset from current index
......
......@@ -56,7 +56,9 @@ void do_exec(
data_idx += data_shape;
megdnn_assert(
data_idx >= 0 && static_cast<size_t>(data_idx) < data_shape,
"bad index value for index %zu at output %zu", i, *index_idx);
"invalid advanced indexing: "
"input index %d is out of bounds for axis %zu with size %zu",
data_idx, i, data_shape);
offset += data_stride * data_idx;
}
for (size_t i = 0; i < nr_nonidx_axes; ++i) {
......
......@@ -37,8 +37,8 @@ namespace {
// cast to uint32 to handle both negative and overflow
set_async_error_info(param.error_info, param.error_tracker,
"invalid advanced indexing: "
"indexer=%d idx=%d shape=%d",
i, data_idx, param.data_shape[i]);
"input index %d is out of bounds for axis %d with size %d",
data_idx, i, param.data_shape[i]);
data_idx = 0;
}
offset += data_idx * param.data_stride[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册