Skip to content
Snippets Groups Projects
Commit 187f78aa authored by Michael Reneer's avatar Michael Reneer Committed by tensorflow-copybara
Browse files

Add a compiler function to the `ExecutionContext` object.

This change adds a compiler function to the `ExecutionContext` object. Conceptually a `Context` can be thought of as an "environment" which owns compilation and owns execution for a given computation. Additionally, this change replaces `set_default_executor` with higher level functions in order to simplify how contexts are constructed.

* Added compiler function to the `ExecutionContext`.
* Deprecated `set_default_executor`.
* Removed all usage of `set_default_executor` internally.
* Added convenience high level functions that set an execution context:
  * tff.backends.native.set_local_execution_context
* Updated `set_default_executor` call-sites to either use the convenience high level functions or to manually construct a context and use `set_default_context`.

Note that we should consider creating the following convenience high level functions:
  * tff.backends.native.set_remote_execution_context
  * tff.backends.native.set_sizing_execution_context
  * tff.backends.iree.set_iree_execution_context

PiperOrigin-RevId: 321263709
parent 997350cd
No related branches found
No related tags found
No related merge requests found
Showing
with 112 additions and 22 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment