Created by: chenwhql
This PR fix two problems:
- Error specification check error
When PADDLE_ENFORCE contains array index [], the grep -vx "$VALID_PADDLE_CHECK"
will treat it as a regular expression metacharacter, resulting in a judgment error.
So this PR add -F
to fix this problem.
-F, --fixed-strings PATTERN is a set of newline-separated strings
error example: https://github.com/PaddlePaddle/Paddle/pull/20972
- : All PADDLE_ENFORCE{_*} this PR added
/work/paddle {gaowei/padding-fcc} ALL_PADDLE_CHECK=`git diff -U0 upstream/develop |grep "+" |grep -zoE "(PADDLE_ENFORCE[A-Z_]{0,9}|PADDLE_THROW)\(.[^,\);]*.[^;]*\);\s" || true`
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/work/paddle {gaowei/padding-fcc} echo "$ALL_PADDLE_CHECK"
PADDLE_ENFORCE_GT(batch_size, 0, platform::errors::InvalidArgument(
+ "Batch size is illegal.", batch_size));
PADDLE_ENFORCE_EQ(
+ bias_dims[1], w_dims1,
+ platform::errors::InvalidArgument(
+ "The shape of Bias is invalid."
+ "The width of Bias should be equal to width of Weight."
+ "But reveived width of Bias is %d and width of Weight is %d.",
+ bias_dims[1], w_dims1));
PADDLE_ENFORCE_EQ(
+ bias_dims[0], w_dims1,
+ platform::errors::InvalidArgument(
+ "The shape of Bias is invalid."
+ "The height of Bias should be equal to the width of weight."
+ "But reveived height of Bias is %d and width of Weight is %d.",
+ bias_dims[0], w_dims1));
PADDLE_ENFORCE_EQ(in_mat_dims[1], w_dims0,
+ platform::errors::InvalidArgument(
+ "Fully Connected input and weigth size do not match. "
+ "input width: %d,weight height: %d",
+ in_mat_dims[1], w_dims0));
PADDLE_ENFORCE_EQ(
+ weight_padding, false,
+ platform::errors::PermissionDenied(
+ "Weight padding in fc can not be used in GPU scope."));
- : Valid PADDLE_ENFORCE{_*} this PR added
/work/paddle {gaowei/padding-fcc} VALID_PADDLE_CHECK=`echo "$ALL_PADDLE_CHECK" | grep -zoE '(PADDLE_ENFORCE[A-Z_]{0,9}|PADDLE_THROW)\((.[^,;]+,)*.[^";]*(errors::).[^"]*".[^";]{20,}.[^;]*\);\s' || true`
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/work/paddle {gaowei/padding-fcc} echo "$VALID_PADDLE_CHECK"
PADDLE_ENFORCE_GT(batch_size, 0, platform::errors::InvalidArgument(
+ "Batch size is illegal.", batch_size));
PADDLE_ENFORCE_EQ(
+ bias_dims[1], w_dims1,
+ platform::errors::InvalidArgument(
+ "The shape of Bias is invalid."
+ "The width of Bias should be equal to width of Weight."
+ "But reveived width of Bias is %d and width of Weight is %d.",
+ bias_dims[1], w_dims1));
PADDLE_ENFORCE_EQ(
+ bias_dims[0], w_dims1,
+ platform::errors::InvalidArgument(
+ "The shape of Bias is invalid."
+ "The height of Bias should be equal to the width of weight."
+ "But reveived height of Bias is %d and width of Weight is %d.",
+ bias_dims[0], w_dims1));
PADDLE_ENFORCE_EQ(in_mat_dims[1], w_dims0,
+ platform::errors::InvalidArgument(
+ "Fully Connected input and weigth size do not match. "
+ "input width: %d,weight height: %d",
+ in_mat_dims[1], w_dims0));
PADDLE_ENFORCE_EQ(
+ weight_padding, false,
+ platform::errors::PermissionDenied(
+ "Weight padding in fc can not be used in GPU scope."));
- : Invalid PADDLE_ENFORCE{_*} this PR added (here are error match)
/work/paddle {gaowei/padding-fcc} INVALID_PADDLE_CHECK=`echo "$ALL_PADDLE_CHECK" |grep -vx "$VALID_PADDLE_CHECK" || true`
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
/work/paddle {gaowei/padding-fcc} echo "$INVALID_PADDLE_CHECK"
+ bias_dims[1], w_dims1,
+ bias_dims[1], w_dims1));
+ bias_dims[0], w_dims1,
+ bias_dims[0], w_dims1));
PADDLE_ENFORCE_EQ(in_mat_dims[1], w_dims0,
+ in_mat_dims[1], w_dims0));
- PADDLE_ENFORCE using check match non-code content
Replace with a more precise regular expression