tff.learning.optimizers.check_weights_gradients_match

Stay organized with collections Save and categorize content based on your preferences.

Checks that weights and gradients match.

This check is meant to be used in the next method of implemented tff.learning.optimizers.Optimizer to check whether the provided weights and gradients match, and provide easy and more informative error message.

weights A structure of tensors.
gradients A structure of tensors.

ValueError If weights and gradients do not have the same structure, or if the tensors in the structures do not have the same shapes and dtypes.