Example #1
0
def create_local_execution_context():
    """Creates an XLA-based local execution context.

  NOTE: This context is only directly backed by an XLA executor. It does not
  support any intrinsics, lambda expressions, etc.

  Returns:
    An instance of `execution_context.ExecutionContext` backed by XLA executor.
  """
    # TODO(b/175888145): Extend this into a complete local executor stack.

    factory = executor_stacks.local_executor_factory(
        support_sequence_ops=True,
        leaf_executor_fn=executor.XlaExecutor,
        local_computation_factory=compiler.XlaComputationFactory())
    return execution_context.ExecutionContext(executor_fn=factory)
Example #2
0
 def setUp(self):
     super().setUp()
     self._factory = compiler.XlaComputationFactory()