code: def lars_update(
      w: Union[ivy.Array, ivy.NativeArray],
      dcdw: Union[ivy.Array, ivy.NativeArray],
      lr: Union[float, ivy.Array, ivy.NativeArray],
      /,
      *,
      decay_lambda: float = 0,
      stop_gradients: bool = True,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Update weights ws of some function, given the derivatives of some cost c
      with respect to ws, [dc/dw for w in ws], by applying Layerwise Adaptive
      Rate Scaling (LARS) method.
  
      Parameters
      ----------
      w
          Weights of the function to be updated.
      dcdw
          Derivates of the cost c with respect to the weights ws, [dc/dw for w in ws].
      lr
          Learning rate, the rate at which the weights should be updated relative to the
          gradient.
      decay_lambda
          The factor used for weight decay. Default is zero.
      stop_gradients
          Whether to stop the gradients of the variables after each gradient step.
          Default is ``True``.
      out
          optional output array, for writing the result to. It must have a shape that the
          inputs broadcast to.
  
      Returns
      -------
      ret
          The new function weights ws_new, following the LARS updates.
  
      Examples
      --------
      With :class:`ivy.Array` inputs:
  
      >>> w = ivy.array([[3., 1, 5],
      ...                [7, 2, 9]])
      >>> dcdw = ivy.array([[0.3, 0.1, 0.2],
      ...                   [0.1, 0.2, 0.4]])
      >>> lr = ivy.array(0.1)
      >>> new_weights = ivy.lars_update(w, dcdw, lr)
      >>> print(new_weights)
      ivy.array([[2.34077978, 0.78025991, 4.56051969],
      ...        [6.78026009, 1.56051981, 8.12103939]])
  
      >>> w = ivy.array([3., 1, 5])
      >>> dcdw = ivy.array([0.3, 0.1, 0.2])
      >>> lr = ivy.array(0.1)
      >>> out = ivy.zeros_like(dcdw)
      >>> ivy.lars_update(w, dcdw, lr, out=out)
      >>> print(out)
      ivy.array([2.52565837, 0.8418861 , 4.68377209])
  
      With one :class:`ivy.Container` inputs:
  
      >>> w = ivy.Container(a=ivy.array([3.2, 2.6, 1.3]),
      ...                    b=ivy.array([1.4, 3.1, 5.1]))
      >>> dcdw = ivy.array([0.2, 0.4, 0.1])
      >>> lr = ivy.array(0.1)
      >>> new_weights = ivy.lars_update(w, dcdw, lr)
      >>> print(new_weights)
      {
          a: ivy.array([3.01132035, 2.22264051, 1.2056601]),
          b: ivy.array([1.1324538, 2.56490755, 4.96622658])
      }
  
      With multiple :class:`ivy.Container` inputs:
  
      >>> w = ivy.Container(a=ivy.array([3.2, 2.6, 1.3]),
      ...                    b=ivy.array([1.4, 3.1, 5.1]))
      >>> dcdw = ivy.Container(a=ivy.array([0.2, 0.4, 0.1]),
      ...                       b=ivy.array([0.3,0.1,0.2]))
      >>> lr = ivy.array(0.1)
      >>> new_weights = ivy.lars_update(w, dcdw, lr)
      >>> print(new_weights)
      {
          a: ivy.array([3.01132035, 2.22264051, 1.2056601]),
          b: ivy.array([0.90848625, 2.93616199, 4.77232409])
      }
      """
      w_norm = ivy.vector_norm(w)
      lr = ivy.stable_divide(w_norm * lr, ivy.vector_norm(dcdw))
      if decay_lambda > 0:
          lr /= w_norm * decay_lambda
      return ivy.gradient_descent_update(
          w, dcdw, lr, stop_gradients=stop_gradients, out=out
      )
  
imports: from typing import Sequence, Union, Optional, Tuple, Callable
  import numpy
  import itertools
  import ivy
  from ivy.utils.backend import current_backend
  from ivy.func_wrapper import handle_array_function, inputs_to_ivy_arrays, to_native_arrays_and_back, handle_out_argument, handle_nestable, handle_array_like_without_promotion, handle_device, handle_backend_invalid
  from ivy.utils.exceptions import handle_exceptions
label_desc: Use image node_id 28 for calling a global function with example usage: lars_update() and returns: ivy