未验证 提交 70100e4f 编写于 作者: L Leo Chen 提交者: GitHub

Enhance error message when x or y is empty in elementwise_op (#33928)

* enhance error message when x or y is empty in elementwise_op

* format code

* format code
上级 1cfa1057
...@@ -252,6 +252,10 @@ void CommonForwardBroadcastCPU(const framework::Tensor *x, ...@@ -252,6 +252,10 @@ void CommonForwardBroadcastCPU(const framework::Tensor *x,
std::vector<int> index_array(max_dim, 0); std::vector<int> index_array(max_dim, 0);
const T *x_data = x->data<T>(); const T *x_data = x->data<T>();
const T *y_data = y->data<T>(); const T *y_data = y->data<T>();
PADDLE_ENFORCE_NOT_NULL(x_data, platform::errors::InvalidArgument(
"The input X should not be empty."));
PADDLE_ENFORCE_NOT_NULL(y_data, platform::errors::InvalidArgument(
"The input Y should not be empty."));
OutType *out_data = z->mutable_data<OutType>(ctx.GetPlace()); OutType *out_data = z->mutable_data<OutType>(ctx.GetPlace());
const int out_size = std::accumulate(out_dims_array, out_dims_array + max_dim, const int out_size = std::accumulate(out_dims_array, out_dims_array + max_dim,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册