Browse Source

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

GitOrigin-RevId: 69e6f32e7e
release-1.11.1
Megvii Engine Team 2 years ago
parent
commit
41b9db85e2
3 changed files with 7 additions and 5 deletions
  1. +2
    -2
      dnn/src/cuda/indexing_multi_axis_vec/kern_gen_offset_base.cu
  2. +3
    -1
      dnn/src/naive/indexing_multi_axis_vec/opr_impl.cpp
  3. +2
    -2
      dnn/src/rocm/indexing_multi_axis_vec/kern_gen_offset_base.cpp.hip

+ 2
- 2
dnn/src/cuda/indexing_multi_axis_vec/kern_gen_offset_base.cu View File

@@ -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


+ 3
- 1
dnn/src/naive/indexing_multi_axis_vec/opr_impl.cpp View File

@@ -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) {


+ 2
- 2
dnn/src/rocm/indexing_multi_axis_vec/kern_gen_offset_base.cpp.hip View File

@@ -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];


Loading…
Cancel
Save