View source on GitHub |
A container for the trainable and non-trainable variables of a Model
.
tff.learning.models.ModelWeights(
trainable, non_trainable
)
Used in the notebooks
Used in the tutorials |
---|
Note this does not include the model's local variables.
It may also be used to hold other values that are parallel to these variables, e.g., tensors corresponding to variable values, or updates to model variables.
Attributes | |
---|---|
trainable
|
A namedtuple alias for field number 0
|
non_trainable
|
A namedtuple alias for field number 1
|
Methods
assign_weights_to
assign_weights_to(
model: Union[tff.learning.models.VariableModel
, tf.keras.Model]
) -> None
Assign these TFF model weights to the weights of a model.
Args | |
---|---|
model
|
A tf.keras.Model or tff.learning.models.VariableModel instance
to assign the weights to.
|
convert_variables_to_arrays
convert_variables_to_arrays() -> 'ModelWeights'
Converts any internal tf.Variable
s to numpy arrays.
from_model
@classmethod
from_model( model )
from_tff_result
@classmethod
from_tff_result( struct )