

def variable(name, shape=None, dtype=tf.float32, initializer=None, regularizer=None, trainable=True, collections=None, device='', restore=True):
    " variable.\n\n    Instantiate a new variable.\n\n    Arguments:\n        name: `str`. A name for this variable.\n        shape: list of `int`. The variable shape (optional).\n        dtype: `type`. The variable data type.\n        initializer: `str` or `Tensor`. The variable initialization. (See\n            tflearn.initializations for references).\n        regularizer: `str` or `Tensor`. The variable regularizer. (See\n            tflearn.losses for references).\n        trainable: `bool`. If True, this variable weights will be trained.\n        collections: `str`. A collection to add the new variable to (optional).\n        device: `str`. Device ID to store the variable. Default: '/cpu:0'.\n        restore: `bool`. Restore or not this variable when loading a\n            pre-trained model (Only compatible with tflearn pre-built\n            training functions).\n\n    Returns:\n        A Variable.\n\n    "
    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)
        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, dtype)
        if (not restore):
            tf.add_to_collection(tf.GraphKeys.EXCL_RESTORE_VARS, var)
        return var

dataset/ETHPy150Open tflearn/tflearn/tflearn/variables.py variable/VarMisuse@192/525 `regularizer`->`dtype`