fix the reduce bug test=develop (#20102)

revert-20712-fix_depthwise_conv
wangchaochaohu 6 years ago committed by GitHub
parent 9bffbb7db9
commit bc6126dd07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -171,6 +171,12 @@ class ReduceOp : public framework::OperatorWithKernel {
"dimensions = %d, X's shape = [%s].",
x_rank, x_dims);
auto dims = ctx->Attrs().Get<std::vector<int>>("dim");
PADDLE_ENFORCE_GT(
dims.size(), 0,
"ShapeError: The input dim dimensions of Reduce "
"shoud be greater than 0. But received the dim dimesions of Reduce "
" = %d",
dims.size());
for (size_t i = 0; i < dims.size(); ++i) {
PADDLE_ENFORCE_LT(dims[i], x_rank,

@ -138,8 +138,7 @@ class SimpleRNNCell(fluid.Layer):
type='reduce_sum',
inputs={'X': softmax_out},
outputs={'Out': reduce_out},
attrs={'dim': [],
'keep_dim': False,
attrs={'keep_dim': False,
'reduce_all': True})
return reduce_out, hidden

Loading…
Cancel
Save