

def variable(value, dtype=_FLOATX, name=None):
    'Instantiates a tensor.\n\n    # Arguments\n        value: numpy array, initial value of the tensor.\n        dtype: tensor type.\n        name: optional name string for the tensor.\n\n    # Returns\n        Tensor variable instance.\n    '
    v = tf.Variable(np.asarray(value, dtype=dtype), name=name)
    if (tf.get_default_graph() is get_session().graph):
        try:
            get_session().run(v.initializer)
        except tf.errors.InvalidArgumentError:
            warnings.warn('Could not automatically initialize variable, make sure you do it manually (e.g. via `tf.initialize_all_variables()`).')
    else:
        warnings.warn('The default TensorFlow graph is not the graph associated with the TensorFlow session currently registered with Keras, and as such Keras was not able to automatically initialize a variable. You should consider registering the proper session with Keras via `K.set_session(sess)`.')
    return v

dataset/ETHPy150Open fchollet/keras/keras/backend/tensorflow_backend.py variable/original