Executes a function while respecting device annotations. Currently, only those functions that execute within the same address space can be executed. Args: args: The arguments of the function, including captured inputs. f: The function to execute; an instance of `_DefinedFunction` or
(args,
f,
tout=None,
executing_eagerly=None,
config=None,
executor_type=None)
| 806 | |
| 807 | |
| 808 | def partitioned_call(args, |
| 809 | f, |
| 810 | tout=None, |
| 811 | executing_eagerly=None, |
| 812 | config=None, |
| 813 | executor_type=None): |
| 814 | """Executes a function while respecting device annotations. |
| 815 | |
| 816 | Currently, only those functions that execute within the same address space |
| 817 | can be executed. |
| 818 | |
| 819 | Args: |
| 820 | args: The arguments of the function, including captured inputs. |
| 821 | f: The function to execute; an instance of `_DefinedFunction` or |
| 822 | `_EagerDefinedFunction`. |
| 823 | tout: a list containing the output dtypes enums; if `None`, inferred from |
| 824 | the signature of `f`. |
| 825 | executing_eagerly: (Optional) A boolean indicating whether the context is |
| 826 | executing eagerly. If `None`, fetched from the global context. |
| 827 | config: (Optional) A `tensorflow::ConfigProto` proto, serialized. If `None`, |
| 828 | all optimizations are disabled. Currently only handled for eager defined |
| 829 | functions. |
| 830 | executor_type: (Optional) A string for the name of the executor to be used |
| 831 | in the function call. If not set, or set to an empty string, the default |
| 832 | tensorflow executor will be used. |
| 833 | |
| 834 | Returns: |
| 835 | The list of `Tensor`s returned by invoking `f(args)`. If the function does |
| 836 | not return anything, then returns `None` if eager execution is enabled, or |
| 837 | the `Operation` if not. |
| 838 | """ |
| 839 | |
| 840 | if tout is None: |
| 841 | tout = tuple(x.type for x in f.definition.signature.output_arg) |
| 842 | |
| 843 | if executing_eagerly is None: |
| 844 | executing_eagerly = context.executing_eagerly() |
| 845 | |
| 846 | if config is None: |
| 847 | config = function_utils.get_disabled_rewriter_config() |
| 848 | |
| 849 | if executor_type is None: |
| 850 | executor_type = "" |
| 851 | |
| 852 | if executing_eagerly or len(tout): |
| 853 | if f.stateful_ops: |
| 854 | outputs = gen_functional_ops.stateful_partitioned_call( |
| 855 | args=args, |
| 856 | Tout=tout, |
| 857 | f=f, |
| 858 | config_proto=config, |
| 859 | executor_type=executor_type) |
| 860 | else: |
| 861 | outputs = gen_functional_ops.partitioned_call( |
| 862 | args=args, |
| 863 | Tout=tout, |
| 864 | f=f, |
| 865 | config_proto=config, |
nothing calls this directly
no test coverage detected