aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/python/lite_test.py
diff options
context:
space:
mode:
authorGravatar Nupur Garg <nupurgarg@google.com>2018-06-04 13:42:17 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-04 13:45:15 -0700
commit279b899642c22734a5bd3b375a2fa9f84aa4738c (patch)
tree5e52939b07059ab7d61dc3bbf4dfb95cd55de45b /tensorflow/contrib/lite/python/lite_test.py
parentd1c2dbd99c046b6258fd9a8637df8abf1101122f (diff)
Improve TOCO error handling.
PiperOrigin-RevId: 199186109
Diffstat (limited to 'tensorflow/contrib/lite/python/lite_test.py')
-rw-r--r--tensorflow/contrib/lite/python/lite_test.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/tensorflow/contrib/lite/python/lite_test.py b/tensorflow/contrib/lite/python/lite_test.py
index 53d1878293..5f8dfc0dc1 100644
--- a/tensorflow/contrib/lite/python/lite_test.py
+++ b/tensorflow/contrib/lite/python/lite_test.py
@@ -131,21 +131,31 @@ class FromSessionTest(test_util.TensorFlowTestCase):
'Quantization input stats are not available for input tensors '
'\'inputB\'.', str(error.exception))
- def testBatchSizeInvalid(self):
- in_tensor = array_ops.placeholder(
- shape=[None, 16, 16, 3], dtype=dtypes.float32)
+ def testSizeNoneInvalid(self):
+ in_tensor = array_ops.placeholder(dtype=dtypes.float32)
out_tensor = in_tensor + in_tensor
sess = session.Session()
# Test invalid shape. None after 1st dimension.
+ converter = lite.TocoConverter.from_session(sess, [in_tensor], [out_tensor])
+ with self.assertRaises(ValueError) as error:
+ converter.convert()
+ self.assertEqual('Provide an input shape for input array \'Placeholder\'.',
+ str(error.exception))
+
+ def testBatchSizeInvalid(self):
in_tensor = array_ops.placeholder(
shape=[1, None, 16, 3], dtype=dtypes.float32)
+ out_tensor = in_tensor + in_tensor
+ sess = session.Session()
+
+ # Test invalid shape. None after 1st dimension.
converter = lite.TocoConverter.from_session(sess, [in_tensor], [out_tensor])
with self.assertRaises(ValueError) as error:
converter.convert()
self.assertEqual(
'None is only supported in the 1st dimension. Tensor '
- '\'Placeholder_1:0\' has invalid shape \'[1, None, 16, 3]\'.',
+ '\'Placeholder\' has invalid shape \'[1, None, 16, 3]\'.',
str(error.exception))
def testBatchSizeValid(self):