diff --git a/tensorflow/python/ops/image_ops_impl.py b/tensorflow/python/ops/image_ops_impl.py index c5a3611b1d0..11720b285e2 100644 --- a/tensorflow/python/ops/image_ops_impl.py +++ b/tensorflow/python/ops/image_ops_impl.py @@ -5237,7 +5237,9 @@ def non_max_suppression_padded(boxes, Dimensions except the last two are batch dimensions. scores: a tensor of rank 1 or higher with a shape of [..., num_boxes]. max_output_size: a scalar integer `Tensor` representing the maximum number - of boxes to be selected by non max suppression. + of boxes to be selected by non max suppression. Note that setting this + value to a large number may result in OOM error depending on the system + workload. iou_threshold: a float representing the threshold for deciding whether boxes overlap too much with respect to IoU (intersection over union). score_threshold: a float representing the threshold for box scores. Boxes diff --git a/tensorflow/python/ops/image_ops_test.py b/tensorflow/python/ops/image_ops_test.py index 653272e7015..7b477aab796 100644 --- a/tensorflow/python/ops/image_ops_test.py +++ b/tensorflow/python/ops/image_ops_test.py @@ -5211,6 +5211,17 @@ class NonMaxSuppressionPaddedTest(test_util.TensorFlowTestCase, self.assertAllClose(selected_indices, [0, 2, 4]) self.assertEqual(self.evaluate(num_valid), 3) + def testInvalidDtype(self): + boxes_np = [[4.0, 6.0, 3.0, 6.0], + [2.0, 1.0, 5.0, 4.0], + [9.0, 0.0, 9.0, 9.0]] + scores = [5.0, 6.0, 5.0] + max_output_size = 2**31 + with self.assertRaisesRegex( + (TypeError, ValueError), "type int64 that does not match type int32"): + boxes = constant_op.constant(boxes_np) + image_ops.non_max_suppression_padded(boxes, scores, max_output_size) + class NonMaxSuppressionWithOverlapsTest(test_util.TensorFlowTestCase):