|View source on GitHub|
Converts the argument into an instance of the abstract class
tff.to_value( val, type_spec=None )
tff.Value represent TFF values that appear internally in
federated computations. This helper function can be used to wrap a variety of
Python objects as
tff.Value instances to allow them to be passed as
arguments, used as functions, or otherwise manipulated within bodies of
At the moment, the supported types include:
Simple constants of
booltypes, mapped to values of a TFF tensor type.
Numpy arrays (
np.ndarrayobjects), also mapped to TFF tensors.
Structs, all of which are mapped to TFF tuple type.
This function is also invoked when attempting to execute a TFF computation. All arguments supplied in the invocation are converted into TFF values prior to execution. The types of Python objects that can be passed as arguments to computations thus matches the types listed here.
An instance of one of the Python types that are convertible to TFF
values (instances of
||An optional type specifier that allows for disambiguating the target type (e.g., when two TFF types can be mapped to the same Python representations). If not specified, TFF tried to determine the type of the TFF value automatically.|
An instance of