25 lines
1.1 KiB
Diff
25 lines
1.1 KiB
Diff
|
|
From 744009c9e5cc5d0447f0dc39d055f917e1fd9e16 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Mihai Maruseac <mihaimaruseac@google.com>
|
||
|
|
Date: Fri, 23 Apr 2021 12:00:12 -0700
|
||
|
|
Subject: [PATCH] Validate work in `QuantizedAdd`, ensure at least one element.
|
||
|
|
|
||
|
|
PiperOrigin-RevId: 370127996
|
||
|
|
Change-Id: I57c6f3e01afdeada84737820a131590137463855
|
||
|
|
---
|
||
|
|
tensorflow/core/kernels/quantized_add_op.cc | 2 ++
|
||
|
|
1 file changed, 2 insertions(+)
|
||
|
|
|
||
|
|
diff --git a/tensorflow/core/kernels/quantized_add_op.cc b/tensorflow/core/kernels/quantized_add_op.cc
|
||
|
|
index 55c69de7d3ea6..b186f00f15c06 100644
|
||
|
|
--- a/tensorflow/core/kernels/quantized_add_op.cc
|
||
|
|
+++ b/tensorflow/core/kernels/quantized_add_op.cc
|
||
|
|
@@ -538,6 +538,8 @@ class QuantizedAddOp : public OpKernel {
|
||
|
|
tensor_min = min_x;
|
||
|
|
tensor_max = max_x;
|
||
|
|
}
|
||
|
|
+ OP_REQUIRES(context, vector_num_elements > 0,
|
||
|
|
+ errors::InvalidArgument("Must have some elements to add"));
|
||
|
|
VectorTensorAddition<T, Toutput>(
|
||
|
|
vector_data, vector_min, vector_max, vector_num_elements, tensor_data,
|
||
|
|
tensor_min, tensor_max, tensor_num_elements, min_z_value, max_z_value,
|