Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fix one FPE and remove two CHECK-fails.
PiperOrigin-RevId: 369349640
Change-Id: I1fedbfc2b5bab635c5cb51f103d7c9176f79831a
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Apr 20, 2021
1 parent 00e9a4d commit cfa91be
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tensorflow/core/kernels/quantized_conv_ops.cc
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

0 comments on commit cfa91be

Please sign in to comment.