def variable(name, shape=None, dtype=tf.float32, initializer=None,
             regularizer=None, trainable=True, collections=None, device='',
             restore=True):

    if isinstance(initializer, str):
        initializer = tflearn.initializations.get(initializer)()

    if isinstance(regularizer, str):
        regularizer = tflearn.losses.get(regularizer)

    with tf.device(device):

        try:
            var = tf.get_variable(name, shape=shape, dtype=dtype,
                                  initializer=initializer,
                                  regularizer=regularizer,
                                  trainable=trainable,
                                  collections=collections)
        # Fix for old TF versions
        except Exception as e:
            var = tf.get_variable(name, shape=shape, dtype=dtype,
                                  initializer=initializer,
                                  trainable=trainable,
                                  collections=collections)
            if regularizer is not None:
                tflearn.add_weights_regularizer(var, regularizer)

        if not restore:
            tf.add_to_collection(tf.GraphKeys.EXCL_RESTORE_VARS, var)

        return var
variable.
dataset/ETHPy150Open tflearn/tflearn/tflearn/variables.py/variable