Commit f74ae662 authored by Zhichao Lu's avatar Zhichao Lu Committed by pkulzc
Browse files

Make box_list_ops_test.py work with the C API enabled.

The C API improves static shape inference, making more errors caught at graph construction time instead of runtime.

PiperOrigin-RevId: 190095450
parent 8fdf31d6
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
import numpy as np import numpy as np
import tensorflow as tf import tensorflow as tf
from tensorflow.python.framework import errors from tensorflow.python.framework import errors
from tensorflow.python.framework import ops
from object_detection.core import box_list from object_detection.core import box_list
from object_detection.core import box_list_ops from object_detection.core import box_list_ops
...@@ -509,9 +510,13 @@ class BoxListOpsTest(tf.test.TestCase): ...@@ -509,9 +510,13 @@ class BoxListOpsTest(tf.test.TestCase):
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
box_list_ops.sort_by_field(boxes, 'misc') box_list_ops.sort_by_field(boxes, 'misc')
with self.assertRaisesWithPredicateMatch(errors.InvalidArgumentError, if ops._USE_C_API:
'Incorrect field size'): with self.assertRaises(ValueError):
sess.run(box_list_ops.sort_by_field(boxes, 'weights').get()) box_list_ops.sort_by_field(boxes, 'weights')
else:
with self.assertRaisesWithPredicateMatch(errors.InvalidArgumentError,
'Incorrect field size'):
sess.run(box_list_ops.sort_by_field(boxes, 'weights').get())
def test_visualize_boxes_in_image(self): def test_visualize_boxes_in_image(self):
image = tf.zeros((6, 4, 3)) image = tf.zeros((6, 4, 3))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment