code: def set_all_param_values(layer, values, **tags):
      """
      Given a list of numpy arrays, this function sets the parameters of all
      layers below one or more given :class:`Layer` instances (including the
      layer(s) itself) to the given values.
  
      This function can be used in conjunction with get_all_param_values to save
      and restore model parameters.
  
      Parameters
      ----------
      layer : Layer or list
          The :class:`Layer` instance for which to set all parameter values, or a
          list of :class:`Layer` instances.
  
      values : list of numpy.array
          A list of numpy arrays representing the parameter values, must match
          the number of parameters.
          Every parameter's shape must match the shape of its new value.
  
      **tags (optional)
          tags can be specified to filter the list of parameters to be set.
          Specifying ``tag1=True`` will limit the list to parameters that are
          tagged with ``tag1``.
          Specifying ``tag1=False`` will limit the list to parameters that
          are not tagged with ``tag1``. Commonly used tags are
          ``regularizable`` and ``trainable``.
  
      Raises
      ------
      ValueError
          If the number of values is not equal to the number of params, or
          if a parameter's shape does not match the shape of its new value.
  
      Examples
      --------
      >>> from lasagne.layers import InputLayer, DenseLayer
      >>> l_in = InputLayer((100, 20))
      >>> l1 = DenseLayer(l_in, num_units=50)
      >>> all_param_values = get_all_param_values(l1)
      >>> # all_param_values is now [l1.W.get_value(), l1.b.get_value()]
      >>> # ...
      >>> set_all_param_values(l1, all_param_values)
      >>> # the parameter values are restored.
      """
      params = get_all_params(layer, **tags)
      if len(params) != len(values):
          raise ValueError(
              "mismatch: got %d values to set %d parameters"
              % (len(values), len(params))
          )
  
      for p, v in zip(params, values):
          if p.get_value().shape != v.shape:
              raise ValueError(
                  "mismatch: parameter has shape %r but value to "
                  "set has shape %r" % (p.get_value().shape, v.shape)
              )
          else:
              p.set_value(v)
  
file_path: Lasagne/lasagne/layers/helper.py
imports: from collections import deque
  from difflib import get_close_matches
  from itertools import chain
  from warnings import warn
  import theano
  import numpy
  from ..None import utils
label_desc: Use image node_id 7 for calling a global function with example usage: set_all_param_values(layer, values) without return types