Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/lite/python/lite_constants.py: 100%

30 statements  

« prev     ^ index     » next       coverage.py v7.4.0, created at 2024-01-03 07:57 +0000

1# Copyright 2018 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"""Constants for TFLite.""" 

16 

17from tensorflow.lite.toco import toco_flags_pb2 as _toco_flags_pb2 

18from tensorflow.python.framework import dtypes 

19from tensorflow.python.util.all_util import remove_undocumented 

20from tensorflow.python.util.tf_export import tf_export as _tf_export 

21 

22FLOAT = dtypes.float32 

23FLOAT16 = dtypes.float16 

24INT32 = dtypes.int32 

25INT64 = dtypes.int64 

26STRING = dtypes.string 

27QUANTIZED_UINT8 = dtypes.uint8 

28INT8 = dtypes.int8 

29INT16 = dtypes.int16 

30COMPLEX64 = dtypes.complex64 

31TENSORFLOW_GRAPHDEF = _toco_flags_pb2.TENSORFLOW_GRAPHDEF 

32TFLITE = _toco_flags_pb2.TFLITE 

33GRAPHVIZ_DOT = _toco_flags_pb2.GRAPHVIZ_DOT 

34 

35_tf_export(v1=["lite.constants.FLOAT"]).export_constant(__name__, "FLOAT") 

36_tf_export(v1=["lite.constants.FLOAT16"]).export_constant(__name__, "FLOAT16") 

37_tf_export(v1=["lite.constants.INT32"]).export_constant(__name__, "INT32") 

38_tf_export(v1=["lite.constants.INT64"]).export_constant(__name__, "INT64") 

39_tf_export(v1=["lite.constants.STRING"]).export_constant(__name__, "STRING") 

40_tf_export(v1=["lite.constants.QUANTIZED_UINT8"]).export_constant( 

41 __name__, "QUANTIZED_UINT8") 

42_tf_export(v1=["lite.constants.INT8"]).export_constant(__name__, "INT8") 

43_tf_export(v1=["lite.constants.INT16"]).export_constant(__name__, "INT16") 

44_tf_export(v1=["lite.constants.TFLITE"]).export_constant(__name__, "TFLITE") 

45_tf_export(v1=["lite.constants.GRAPHVIZ_DOT"]).export_constant( 

46 __name__, "GRAPHVIZ_DOT") 

47 

48# Currently the default mode of operation is to shell to another python process 

49# to protect against crashes. However, it breaks some dependent targets because 

50# it forces us to depend on an external py_binary. The experimental API doesn't 

51# have that drawback. 

52EXPERIMENTAL_USE_TOCO_API_DIRECTLY = False 

53 

54 

55_allowed_symbols = [ 

56 "FLOAT", 

57 "FLOAT16", 

58 "INT32", 

59 "INT64", 

60 "STRING", 

61 "QUANTIZED_UINT8", 

62 "INT8", 

63 "INT16", 

64 "COMPLEX64", 

65 "TENSORFLOW_GRAPHDEF", 

66 "TFLITE", 

67 "GRAPHVIZ_DOT", 

68 "EXPERIMENTAL_USE_TOCO_API_DIRECTLY", 

69] 

70remove_undocumented(__name__, _allowed_symbols)