(learning_rate)
return init, update, get_params
Construct optimizer triple for stochastic gradient descent (SGD).

  Inspired by the optimizer definitions in JAX
  (https://github.com/google/jax/blob/main/jax/experimental/optimizers.py),
  this implementation of SGD is fully functional (i.e., it maintains no hidden
  state) and so is compatible for use with an optimization-based meta-learner.

  Args:
    learning_rate: A positive scalar.

  Returns:
    An (init, update, get_params) function triple.
Construct optimizer triple for stochastic gradient descent (SGD).
Construct optimizer triple for stochastic gradient descent ( SGD ) .
def sgd(learning_rate):
  """Construct optimizer triple for stochastic gradient descent (SGD).

  Inspired by the optimizer definitions in JAX
  (https://github.com/google/jax/blob/main/jax/experimental/optimizers.py),
  this implementation of SGD is fully functional (i.e., it maintains no hidden
  state) and so is compatible for use with an optimization-based meta-learner.

  Args:
    learning_rate: A positive scalar.

  Returns:
    An (init, update, get_params) function triple.
  """

  def init(x0):
    return x0

  def update(i, grad, state):
    del i
    x = state
    return x - learning_rate * grad

  def get_params(state):
    x = state
    return x

  return init, update, get_params
def sgd ( learning_rate ) : def init ( x0 ) : return x0 def update ( i , grad , state ) : del i x = state return x - learning_rate * grad def get_params ( state ) : x = state return x return init , update , get_params