• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ==============================================================================
15"""Tests for test_util.py."""
16
17from __future__ import absolute_import
18from __future__ import division
19from __future__ import print_function
20
21from tensorflow.lite.python import test_util as tflite_test_util
22from tensorflow.python.framework import test_util
23from tensorflow.python.platform import gfile
24from tensorflow.python.platform import resource_loader
25from tensorflow.python.platform import test
26
27
28class TestUtilTest(test_util.TensorFlowTestCase):
29
30  def testBuiltinOp(self):
31    model_path = resource_loader.get_path_to_datafile('../testdata/add.bin')
32    op_set = tflite_test_util.get_ops_list(gfile.GFile(model_path, 'rb').read())
33    self.assertCountEqual(op_set, ['ADD'])
34
35  def testFlexOp(self):
36    model_path = resource_loader.get_path_to_datafile(
37        '../testdata/softplus_flex.bin')
38    op_set = tflite_test_util.get_ops_list(gfile.GFile(model_path, 'rb').read())
39    self.assertCountEqual(op_set, ['FlexSoftplus'])
40
41
42if __name__ == '__main__':
43  test.main()
44