(self)
| 455 | class TestFlexMode(test_util.TensorFlowTestCase): |
| 456 | |
| 457 | def testSession(self): |
| 458 | with ops.Graph().as_default(): |
| 459 | in_tensor = array_ops.placeholder( |
| 460 | shape=[1, 16, 16, 3], dtype=dtypes.float32) |
| 461 | out_tensor = in_tensor + in_tensor |
| 462 | sess = session.Session() |
| 463 | |
| 464 | # Convert model and ensure model is not None. |
| 465 | converter = lite.TFLiteConverter.from_session(sess, [in_tensor], |
| 466 | [out_tensor]) |
| 467 | converter.experimental_enable_mlir_converter = True |
| 468 | converter.target_spec.supported_ops = set([lite.OpsSet.SELECT_TF_OPS]) |
| 469 | tflite_model = converter.convert() |
| 470 | |
| 471 | # Ensures the model contains TensorFlow ops. |
| 472 | # TODO(nupurgarg): Check values once there is a Python delegate interface. |
| 473 | interpreter = Interpreter(model_content=tflite_model) |
| 474 | with self.assertRaises(RuntimeError) as error: |
| 475 | interpreter.allocate_tensors() |
| 476 | self.assertIn( |
| 477 | 'Regular TensorFlow ops are not supported by this interpreter. Make ' |
| 478 | 'sure you invoke the Flex delegate before inference.', |
| 479 | str(error.exception)) |
| 480 | |
| 481 | @test_util.run_v2_only |
| 482 | def testConcreteFunc(self): |
nothing calls this directly
no test coverage detected