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 one FPE and remove two CHECK-fails. #49385

Merged
merged 1 commit into from
May 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions tensorflow/core/kernels/quantized_conv_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.
#include <algorithm>
#include <vector>

#include "tensorflow/core/platform/errors.h"

#define EIGEN_USE_THREADS

#define GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
Expand Down Expand Up @@ -227,8 +229,12 @@ class Im2ColConvFunctor {
return;
}

CHECK_GT(output_width, 0);
CHECK_GT(output_height, 0);
OP_REQUIRES(
context, output_width > 0,
errors::InvalidArgument("output_width must be strictly positive"));
OP_REQUIRES(
context, output_height > 0,
errors::InvalidArgument("output_height must be strictly positive"));
int filter_left_offset;
int filter_top_offset;
if (padding == VALID) {
Expand All @@ -255,6 +261,9 @@ class Im2ColConvFunctor {
// by the width, then the height. This is the standard memory order in the
// image world if it helps to visualize it.
const int filter_value_count = filter_width * filter_height * input_depth;
OP_REQUIRES(context, filter_value_count > 0,
errors::InvalidArgument(
"filter patch must contain at least one element"));
const int64 patches_per_chunk =
kMaxChunkSize / (filter_value_count * sizeof(T1));
const int64 chunk_value_count =
Expand Down