예제 #1
0
    def test_compile_simple_fp16(self):
        compiled_1 = compiler.compile_source(source=_make_saved_model(), config=Config())

        compiled_2 = compiler.compile_source(source=_make_saved_model(),
                                             config=Config(optimization=True, supported_types=[tf.float16]))

        self.assertLess(len(compiled_2.tflite_model), len(compiled_1.tflite_model))
    def test_compile_simple(self):
        compiled = compiler.compile_source(source=_make_saved_model(),
                                           config=Config())

        self.assertIsInstance(compiled.tflite_model, bytes)
        self.assertEqual(compiled.input_formats,
                         [DataFormat.CHANNELS_FIRST, DataFormat.CHANNELS_LAST])
    def test_compile_select_tf_op(self):
        compiled = compiler.compile_source(
            source=_make_saved_model(),
            config=Config(supported_ops=[tf.lite.OpsSet.SELECT_TF_OPS]))

        self.assertIsInstance(compiled.tflite_model, bytes)
        self.assertEqual(compiled.input_formats,
                         [DataFormat.CHANNELS_FIRST, DataFormat.CHANNELS_LAST])