![]() |
The data executor is responsible for the data
building block.
tff.framework.DataExecutor(
target_executor: executor_base.Executor,
data_backend: tff.framework.DataBackend
)
Args | |
---|---|
target_executor
|
Downstream executor that this executor delegates to. |
data_backend
|
The data backend responsible for materializing payloads. |
Raises | |
---|---|
TypeError
|
if arguments are of the wrong types. |
Methods
close
close()
Release resources associated with this Executor, if any.
If the executor has one or more target Executors, implementation of this method must close them.
create_call
create_call(
comp, arg=None
)
A coroutine that creates a call to comp
with optional argument arg
.
Args | |
---|---|
comp
|
The computation to invoke. It must have been first embedded in the
executor by calling create_value() on it first.
|
arg
|
An optional argument of the call, or None if no argument was
supplied. If it is present, it must have been embedded in the executor
by calling create_value() on it first.
|
Returns | |
---|---|
An instance of ExecutorValue that represents the constructed call.
|
create_selection
create_selection(
source, index
)
A coroutine that creates a selection from source
.
Args | |
---|---|
source
|
The source to select from. The source must have been embedded in
this executor by invoking create_value() on it first.
|
index
|
An integer index to select. |
Returns | |
---|---|
An instance of ExecutorValue that represents the constructed selection.
|
create_struct
create_struct(
elements
)
A coroutine that creates a tuple of elements
.
Args | |
---|---|
elements
|
A collection of ExecutorValue s to create a tuple from. The
collection may be of any kind accepted by structure.from_container ,
including dictionaries and lists. The ExecutorValues in the container
must have been created by calling create_value on this executor.
|
Returns | |
---|---|
An instance of ExecutorValue that represents the constructed tuple.
|
create_value
create_value(
value, type_spec=None
)
Creates a value in this executor.
The following kinds of value
are supported as the input:
An instance of a TFF computation proto that represents a
data
building block, to be handled natively by this executor.Anything that is supported by the target executor (as a pass-through).
A nested structure of any of the above.
Args | |
---|---|
value
|
The input for which to create a value. |
type_spec
|
An optional TFF type of value .
|
Returns | |
---|---|
A value embedded in the target executor. |