(self, run_mode, *args, **kwargs)
| 978 | ("_function", "function")) |
| 979 | @functools.wraps(f) |
| 980 | def decorated(self, run_mode, *args, **kwargs): |
| 981 | if run_mode == "v1_graph": |
| 982 | with ops.Graph().as_default(): |
| 983 | f(self, *args, **kwargs) |
| 984 | elif run_mode == "function": |
| 985 | |
| 986 | @def_function.function |
| 987 | def function_in_eager(): |
| 988 | f(self, *args, **kwargs) |
| 989 | |
| 990 | # Create a new graph for the eagerly executed version of this test for |
| 991 | # better isolation. |
| 992 | graph_for_eager_test = ops.Graph() |
| 993 | with graph_for_eager_test.as_default(), context.eager_mode(): |
| 994 | function_in_eager() |
| 995 | ops.dismantle_graph(graph_for_eager_test) |
| 996 | else: |
| 997 | return ValueError("Unknown run mode %s" % run_mode) |
| 998 | |
| 999 | return decorated |
| 1000 |
nothing calls this directly
no test coverage detected