Skip to content

Commit

Permalink
refine add_n_op's error message (#10411)
Browse files Browse the repository at this point in the history
Before this commit, error messge is: **inconsistent tensor size,
expected all tensor to have the same number of elements, but got 640000
and 742400**
After this commit, error message is **inconsistent tensor size, expected
all tensor to have the same number of elements, but got (1,256,50,50)
and (1,256,50,58)**
  • Loading branch information
haoyang9804 authored Jan 22, 2024
1 parent 9afbc9b commit 7ddeacf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions oneflow/user/ops/add_n_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace oneflow {
if (in_0.shape().NumAxes() > 0 && cur_in.shape().NumAxes() > 0) {
CHECK_EQ_OR_RETURN(in_0.shape(), cur_in.shape())
<< Error::RuntimeError()
<< "inconsistent tensor size, expected all tensor to have the same number of elements, "
<< "but got " << in_0.shape().elem_cnt() << " and " << cur_in.shape().elem_cnt();
<< "inconsistent tensor size, expected all tensor to have the same shapes, "
<< "but got " << in_0.shape().ToString() << " and " << cur_in.shape().ToString();
}
}
out->set_shape(in_0.shape());
Expand Down

0 comments on commit 7ddeacf

Please sign in to comment.