Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shape check many by hongyu #16840

Merged
merged 3 commits into from
Apr 17, 2019

Conversation

phlrain
Copy link
Collaborator

@phlrain phlrain commented Apr 13, 2019

tensor_array_read_write_op.cc
data_norm_op.cc
huber_loss_op.cc
layer_norm_op.cc
precision_recall_op.cc
minus_op.cc
modified_huber_loss_op.cc
space_to_depth_op.cc
tree_conv_op.cc

PADDLE_ENFORCE_EQ(x_dims[1], y_dims[1],
"The dim 1 of X and Y must be the same.");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For more simply:

if (ctx->IsRuntime() || (framework::product(x_dims) > 0 && framework::product(y_dims))) {
   PADDLE_ENFORCE_EQ(x_dims, y_dims, ...)
}

但这个check没有当前的code严格

x_dims, y_dims,
"Minus operator must take two tensor with same num of elements");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For short lines:

if ( ctx->IsRuntime() || (framework::product(x_dims) > 0 && framework::product(y_dims) > 0) ) {
}

PADDLE_ENFORCE_EQ(x_dims[1], y_dims[1],
"The dim 1 of X and Y must be the same.");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@phlrain phlrain merged commit 9d5d44f into PaddlePaddle:develop Apr 17, 2019
phlrain added a commit to phlrain/Paddle that referenced this pull request Apr 17, 2019
phlrain added a commit that referenced this pull request Apr 17, 2019
Merge pull request #16840 from phlrain/fix_shape_check_many
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants