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 @@
import numpy as np
import tensorflow as tf
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_ops
......@@ -509,6 +510,10 @@ class BoxListOpsTest(tf.test.TestCase):
with self.assertRaises(ValueError):
box_list_ops.sort_by_field(boxes, 'misc')
if ops._USE_C_API:
with self.assertRaises(ValueError):
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())
......
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