code: def variable(
      name,
      shape=None,
      dtype=tf.float32,
      initializer=None,
      regularizer=None,
      trainable=True,
      collections=None,
      caching_device=None,
      validate_shape=True,
      device=None,
      restore=True,
  ):
      """variable.
  
      Instantiate a new variable.
  
      Arguments:
          name: `str`. A name for this variable.
          shape: list of `int`. The variable shape (optional).
          dtype: `type`. The variable data type.
          initializer: `str` or `Tensor`. The variable initialization. (See
              tflearn.initializations for references).
          regularizer: `str` or `Tensor`. The variable regularizer. (See
              tflearn.losses for references).
          trainable: `bool`. If True, this variable weights will be trained.
          collections: `str`. A collection to add the new variable to (optional).
          caching_device: `str`. Optional device string or function describing
              where the Variable should be cached for reading.  Defaults to the
              Variable's device.
          validate_shape: `bool`. Validate or not shape when restoring.
          device: `str`. Optional device ID to store the variable.
          restore: `bool`. Restore or not this variable when loading a
              pre-trained model (Only compatible with tflearn pre-built
              training functions).
  
      Returns:
          A Variable.
  
      """
  
      if isinstance(initializer, str):
          initializer = tflearn.initializations.get(initializer)()
      # Remove shape param if initializer is a Tensor
      if not callable(initializer) and isinstance(
          initializer, tf.Tensor
      ):
          shape = None
  
      if isinstance(regularizer, str):
          regularizer = tflearn.regularizers.get(regularizer)
  
      collections = set(collections or [])
      collections |= set(
          [tf.GraphKeys.GLOBAL_VARIABLES, tf.GraphKeys.MODEL_VARIABLES]
      )
  
      with tf.device(device or ""):
          var = tf.get_variable(
              name,
              shape=shape,
              dtype=dtype,
              initializer=initializer,
              regularizer=None,
              trainable=trainable,
              collections=collections,
              caching_device=caching_device,
              validate_shape=validate_shape,
          )
  
          if regularizer is not None:
              regul_t = regularizer(var)
              tf.add_to_collection(
                  tf.GraphKeys.REGULARIZATION_LOSSES, regul_t
              )
  
      if not restore:
          tf.add_to_collection(tf.GraphKeys.EXCL_RESTORE_VARS, var)
  
      return var
  
file_path: tflearn/tflearn/variables.py
imports: from __future__ import division, print_function, absolute_import
  import tensorflow.compat.v1
  import tflearn
  from tflearn.vendor.arg_scope import add_arg_scope
label_desc: Use image node_id 1 for calling a global function with example usage: variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, validate_shape, device, restore) and returns: var