docstr: Overwrite model variables with its moving average.
docstr_tok: ["Overwrite","model","variables","with","its","moving","average","."]
code: def _overwrite_model_variables_with_average_value(
      self, trainable_variables
  ):
      """Overwrite model variables with its moving average."""
      if len(trainable_variables) != len(
          self._model_variables_moving_average
      ):
          raise ValueError(
              f"The length of model variables ({len(trainable_variables)}) "
              "to override does not match the length of model variables "
              "stored in the optimizer "
              f"({len(self._model_variables_moving_average)}). Please "
              "check if the optimizer was called on your model."
          )
      for var, average_var in zip(
          trainable_variables, self._model_variables_moving_average
      ):
          var.assign(average_var)
  
imports: import re
  import warnings
  import numpy
  from keras import backend
  from keras import initializers
  from keras import ops
  from keras.optimizers.schedules import learning_rate_schedule
  from keras.saving import serialization_lib
  from keras.utils import tracking
  from keras.utils.naming import auto_name
label_desc: Use image node_id 35 for calling the BaseOptimizer obj's underlying member method code with example usage: obj._overwrite_model_variables_with_average_value(trainable_variables) without return types