code: def shared(
      value, name=None, strict=False, allow_downcast=None, **kwargs
  ):
      """Return a SharedVariable Variable, initialized with a copy or
      reference of `value`.
  
      This function iterates over constructor functions to find a
      suitable SharedVariable subclass.  The suitable one is the first
      constructor that accept the given value.  See the documentation of
      :func:`shared_constructor` for the definition of a constructor
      function.
  
      This function is meant as a convenient default.  If you want to use a
      specific shared variable constructor, consider calling it directly.
  
      ``theano.shared`` is a shortcut to this function.
  
      .. attribute:: constructors
  
      A list of shared variable constructors that will be tried in reverse
      order.
  
      Notes
      -----
      By passing kwargs, you effectively limit the set of potential constructors
      to those that can accept those kwargs.
  
      Some shared variable have ``borrow`` as extra kwargs.
      `See <http://deeplearning.net/software/theano/tutorial/aliasing.\
      html#borrowing-when-creating-shared-variables>`_ for details.
  
      Some shared variable have ``broadcastable`` as extra kwargs. As shared
      variable shapes can change, all dimensions default to not being
      broadcastable, even if ``value`` has a shape of 1 along some dimension.
      This parameter allows you to create for example a `row` or `column` 2d
      tensor.
  
      """
  
      try:
          if isinstance(value, Variable):
              raise TypeError(
                  "Shared variable constructor needs numeric "
                  "values and not symbolic variables."
              )
  
          for ctor in reversed(shared.constructors):
              try:
                  var = ctor(
                      value,
                      name=name,
                      strict=strict,
                      allow_downcast=allow_downcast,
                      **kwargs,
                  )
                  utils.add_tag_trace(var)
                  return var
              except TypeError:
                  continue
              # This may happen when kwargs were supplied
              # if kwargs were given, the generic_constructor won't be callable.
              #
              # This was done on purpose, the rationale being that if kwargs
              # were supplied, the user didn't want them to be ignored.
  
      except MemoryError as e:
          e.args = e.args + (
              "you might consider"
              " using 'theano.shared(..., borrow=True)'",
          )
          raise
  
      raise TypeError(
          "No suitable SharedVariable constructor could be found."
          " Are you sure all kwargs are supported?"
          " We do not support the parameter dtype or type."
          ' value="%s". parameters="%s"' % (value, kwargs)
      )
  
file_path: Theano/theano/compile/sharedvalue.py
imports: from __future__ import absolute_import, print_function, division
  import copy
  import logging
  import numpy
  from theano.gof import Container, Variable, generic, utils
label_desc: Use image node_id 2 for calling a global function with example usage: shared(value, name, strict, allow_downcast) and returns: var