class_docstr: Stochastic Gradient Descent (SGD) module.
  
  Attributes:
    learning_rate: Learning rate.
docstr: Applies updates to parameters.
  
  Args:
    updates: A list of updates to apply to parameters.  Updates are often
      gradients as returned by `tf.GradientTape.gradient`.
    parameters: A list of parameters.
  
  Raises:
    ValueError: If `updates` and `parameters` are empty, have different
      lengths, or have inconsistent types.
docstr_tok: ["Applies","updates","to","parameters",".","Args",":","updates",":","A","list","of","updates","to","apply","to","parameters",".","Updates","are","often","gradients","as","returned","by","`","tf.GradientTape.gradient","`",".","parameters",":","A","list","of","parameters",".","Raises",":","ValueError",":","If","`","updates","`","and","`","parameters","`","are","empty",",","have","different","lengths",",","or","have","inconsistent","types","."]
code: def apply(
      self,
      updates: Sequence[types.ParameterUpdate],
      parameters: Sequence[tf.Variable],
  ):
      """Applies updates to parameters.
  
      Args:
        updates: A list of updates to apply to parameters.  Updates are often
          gradients as returned by `tf.GradientTape.gradient`.
        parameters: A list of parameters.
  
      Raises:
        ValueError: If `updates` and `parameters` are empty, have different
          lengths, or have inconsistent types.
      """
      optimizer_utils.check_distribution_strategy()
      optimizer_utils.check_updates_parameters(updates, parameters)
      for update, parameter in zip(updates, parameters):
          if update is not None:
              optimizer_utils.check_same_dtype(update, parameter)
              learning_rate = tf.cast(self.learning_rate, update.dtype)
              if isinstance(update, tf.IndexedSlices):
                  parameter.scatter_sub(
                      tf.IndexedSlices(
                          update.values * learning_rate, update.indices
                      )
                  )
              else:
                  parameter.assign_sub(update * learning_rate)
  
file_path: sonnet/sonnet/src/optimizers/sgd.py
imports: from typing import Optional, Sequence, Union
  from sonnet.src import base
  from sonnet.src import types
  from sonnet.src.optimizers import optimizer_utils
  import tensorflow
label_desc: Use image node_id 2 for calling the SGD obj's underlying member method code with example usage: obj.apply(updates, parameters) without return types