MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / testBatchSizeValid

Method testBatchSizeValid

tensorflow/lite/python/lite_test.py:338–367  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

336 str(error.exception))
337
338 def testBatchSizeValid(self):
339 with ops.Graph().as_default():
340 in_tensor = array_ops.placeholder(
341 shape=[None, 16, 16, 3], dtype=dtypes.float32)
342 out_tensor = in_tensor + in_tensor
343 sess = session.Session()
344
345 # Convert model and ensure model is not None.
346 converter = lite.TFLiteConverter.from_session(sess, [in_tensor],
347 [out_tensor])
348 tflite_model = converter.convert()
349 self.assertTrue(tflite_model)
350
351 # Check values from converted model.
352 interpreter = Interpreter(model_content=tflite_model)
353 interpreter.allocate_tensors()
354
355 input_details = interpreter.get_input_details()
356 self.assertEqual(1, len(input_details))
357 self.assertEqual('Placeholder', input_details[0]['name'])
358 self.assertEqual(np.float32, input_details[0]['dtype'])
359 self.assertTrue(([1, 16, 16, 3] == input_details[0]['shape']).all())
360 self.assertEqual((0., 0.), input_details[0]['quantization'])
361
362 output_details = interpreter.get_output_details()
363 self.assertEqual(1, len(output_details))
364 self.assertEqual('add', output_details[0]['name'])
365 self.assertEqual(np.float32, output_details[0]['dtype'])
366 self.assertTrue(([1, 16, 16, 3] == output_details[0]['shape']).all())
367 self.assertEqual((0., 0.), output_details[0]['quantization'])
368
369 def testBatchSizeNonZero(self):
370 with ops.Graph().as_default():

Callers

nothing calls this directly

Calls 11

allocate_tensorsMethod · 0.95
get_input_detailsMethod · 0.95
get_output_detailsMethod · 0.95
InterpreterClass · 0.90
as_defaultMethod · 0.45
GraphMethod · 0.45
placeholderMethod · 0.45
SessionMethod · 0.45
from_sessionMethod · 0.45
convertMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected