Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/eager/polymorphic_function/attributes.py: 100%
39 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
1# Copyright 2023 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# ==============================================================================
16"""This file lists FunctionDef attributes and corresponding allowlists."""
18# IMPORTANT: The usage of all the attributes below should be considered tech
19# debt and new additions to this list are discouraged.
20#
21# Historically, attributes have been used as means to pipe extra information
22# down to runtime that is not related to the actual function definition itself.
23#
24# This information is better layered independently and future work is encouraged
25# to pursue that direction instead.
27API_IMPLEMENTS = "api_implements"
28API_PREFERRED_DEVICE = "api_preferred_device"
29BACKWARD_FUNCTION = "backward_function_name"
30DISABLE_CALL_SHAPE_INFERENCE = "_disable_call_shape_inference"
31EAGER_RUNTIME_CONSTRUCTION_CONTEXT = "_construction_context"
32FORWARD_FUNCTION = "forward_function_name"
33GO_BACKWARDS = "go_backwards"
34IMPLEMENTS = "_implements"
35INPUT_SHAPES = "_input_shapes"
36INTS_ON_DEVICE = "experimental_ints_on_device"
37NO_INLINE = "_noinline"
38ORIGINAL_FUNCTION_NAME = "_original_func_name"
39OUTPUTS_ON_OP_DEVICE = "_OutputsOnOpDevice"
40QUANTIZED_COMPOSITE_FUNCTION = "tf_quant.composite_function"
41QUANTIZED_OPS = "tf_quant.quantized_ops"
42RUNTIME_CONSTANT_OPTIMIZATION = "runtime_constant_optimization"
43SHARED_RENDEZVOUS = "shared_rendezvous"
44TF_DATA_FUNCTION = "_tf_data_function"
45TFTRT_ALLOW_BUILD_AT_RUNTIME = "_tftrt_allow_build_at_runtime"
46TFTRT_CONVERT_FUNCTION = "_tftrt_convert_function"
47TFTRT_IS_DYN_OP = "_tftrt_is_dyn_op"
48TFTRT_LOGGER = "_tftrt_trt_logger_name"
49TFTRT_MAX_BATCH_SIZE = "_tftrt_max_batch_size"
50TFTRT_MAX_CACHED_ENGINES = "_tftrt_max_cached_engines"
51TFTRT_MAX_WORKSPACE_SIZE = "_tftrt_max_workspace_size_bytes"
52TFTRT_MIN_SEGMENT_SIZE = "_tftrt_minimum_segment_size"
53TFTRT_PRECISION_MODE = "_tftrt_precision_mode"
54TFTRT_PROFILE_STRATEGY = "_tftrt_profile_strategy"
55TFTRT_USE_CALIBRATION = "_tftrt_use_calibration"
56TFTRT_USE_IMPLICIT_BATCH = "_tftrt_use_implicit_batch"
57TIME_MAJOR = "time_major"
58XLA_COMPILE = "_XlaMustCompile"
59XLA_COMPILE_OPTIONAL = "_XlaCompile"
60XLA_SCOPE = "_XlaScope"
61XLA_SEPERATE_COMPILED_GRADIENTS = "_XlaSeparateCompiledGradients"
63POLYMORPHIC_FUNCTION_ALLOWLIST = frozenset({
64 API_IMPLEMENTS,
65 API_PREFERRED_DEVICE,
66 GO_BACKWARDS,
67 IMPLEMENTS,
68 INTS_ON_DEVICE,
69 NO_INLINE,
70 RUNTIME_CONSTANT_OPTIMIZATION,
71 TF_DATA_FUNCTION,
72 TIME_MAJOR,
73 OUTPUTS_ON_OP_DEVICE,
74})
76TRACING_COMPILER_ALLOWLIST = frozenset().union(
77 POLYMORPHIC_FUNCTION_ALLOWLIST,
78 {
79 SHARED_RENDEZVOUS,
80 XLA_COMPILE,
81 },
82)
84MONOMORPHIC_FUNCTION_ALLOWLIST = frozenset().union(
85 TRACING_COMPILER_ALLOWLIST,
86 {
87 BACKWARD_FUNCTION,
88 DISABLE_CALL_SHAPE_INFERENCE,
89 EAGER_RUNTIME_CONSTRUCTION_CONTEXT,
90 FORWARD_FUNCTION,
91 INPUT_SHAPES,
92 ORIGINAL_FUNCTION_NAME,
93 QUANTIZED_COMPOSITE_FUNCTION,
94 QUANTIZED_OPS,
95 TFTRT_ALLOW_BUILD_AT_RUNTIME,
96 TFTRT_CONVERT_FUNCTION,
97 TFTRT_IS_DYN_OP,
98 TFTRT_LOGGER,
99 TFTRT_MAX_BATCH_SIZE,
100 TFTRT_MAX_CACHED_ENGINES,
101 TFTRT_MAX_WORKSPACE_SIZE,
102 TFTRT_MIN_SEGMENT_SIZE,
103 TFTRT_PRECISION_MODE,
104 TFTRT_PROFILE_STRATEGY,
105 TFTRT_USE_CALIBRATION,
106 TFTRT_USE_IMPLICIT_BATCH,
107 XLA_COMPILE_OPTIONAL,
108 XLA_SCOPE,
109 XLA_SEPERATE_COMPILED_GRADIENTS,
110 },
111)