Skip to content
Permalink
Browse files Browse the repository at this point in the history
Validate min and max arguments to QuantizedResizeBilinear.
PiperOrigin-RevId: 369765091
Change-Id: I33be8b78273ab7d08b97541692fe05cb7f94963a
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Apr 22, 2021
1 parent 5071181 commit f6c40f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tensorflow/core/kernels/quantized_resize_bilinear_op.cc
Expand Up @@ -702,8 +702,14 @@ class QuantizedResizeBilinearOp : public OpKernel {
}

void Compute(OpKernelContext* context) override {
const float in_min = context->input(2).flat<float>()(0);
const float in_max = context->input(3).flat<float>()(0);
const auto& in_min_tensor = context->input(2);
OP_REQUIRES(context, TensorShapeUtils::IsScalar(in_min_tensor.shape()),
errors::InvalidArgument("min must be a scalar"));
const float in_min = in_min_tensor.flat<float>()(0);
const auto& in_max_tensor = context->input(3);
OP_REQUIRES(context, TensorShapeUtils::IsScalar(in_max_tensor.shape()),
errors::InvalidArgument("max must be a scalar"));
const float in_max = in_max_tensor.flat<float>()(0);

ImageResizerState st(align_corners_, false);
st.ValidateAndCreateOutput(context);
Expand Down

0 comments on commit f6c40f0

Please sign in to comment.