Python theano.__version__() Examples

The following are 4 code examples of theano.__version__(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module theano , or try the search function .
Example #1
Source File: main.py    From D-VAE with MIT License 5 votes vote down vote up
def _show_system_info(self):
        import theano
        print("Theano version %s" % theano.__version__)
        theano_dir = os.path.dirname(theano.__file__)
        print("theano is installed in %s" % theano_dir)

        super(TheanoNoseTester, self)._show_system_info() 
Example #2
Source File: main.py    From attention-lvcsr with MIT License 5 votes vote down vote up
def _show_system_info(self):
        import theano
        print("Theano version %s" % theano.__version__)
        theano_dir = os.path.dirname(theano.__file__)
        print("theano is installed in %s" % theano_dir)

        super(TheanoNoseTester, self)._show_system_info() 
Example #3
Source File: checks.py    From deep_qa with Apache License 2.0 5 votes vote down vote up
def log_keras_version_info():
    import keras
    logger.info("Keras version: " + keras.__version__)
    from keras import backend as K
    try:
        backend = K.backend()
    except AttributeError:
        backend = K._BACKEND  # pylint: disable=protected-access
    if backend == 'theano':
        import theano
        logger.info("Theano version: " + theano.__version__)
        logger.warning("Using Keras' theano backend is not supported! Expect to crash...")
    elif backend == 'tensorflow':
        import tensorflow
        logger.info("Tensorflow version: " + tensorflow.__version__)  # pylint: disable=no-member 
Example #4
Source File: __init__.py    From sampleRNN_ICLR2017 with MIT License 4 votes vote down vote up
def print_model_settings(locals_var, path=None, sys_arg=False):
    """
    Prints all variables in upper case in locals_var,
    except for T which usually stands for theano.tensor.
    If locals() passed as input to this method, will print
    all the variables in upper case defined so far, that is
    model settings.

    With `path` as an address to a directory it will _append_ it
    as a file named `model_settings.txt` as well.

    With `sys_arg` set to True, log information about Python, Numpy,
    and Theano and passed arguments to the script will be added too.
    args.pkl would be overwritten, specially in case of resuming a job.
    But again that wouldn't be much of a problem as all the passed args
    to the script except for '--resume' should be the same.

    With both `path` and `sys_arg` passed, dumps the theano.config.

    :usage:
        >>> import theano.tensor as T
        >>> import lib
        >>> BATCH_SIZE, DIM = 128, 512
        >>> DATA_PATH = '/Path/to/dataset'
        >>> lib.print_model_settings(locals(), path='./')
    """
    log = ""
    if sys_arg:
        try:
            log += "Python:\n"
            log += "\tsys.version_info\t{}\n".format(str(sys.version_info))
            log += "Numpy:\n"
            log += "\t.__version__\t{}\n".format(numpy.__version__)
            log += "Theano:\n"
            log += "\t.__version__\t{}\n".format(theano.__version__)
            log += "\n\nAll passed args:\n"
            log += str(sys.argv)
            log += "\n"
        except:
            print "Something went wrong during sys_arg logging. Continue anyway!"

    log += "\nModel settings:"
    all_vars = [(k,v) for (k,v) in locals_var.items() if (k.isupper() and k != 'T')]
    all_vars = sorted(all_vars, key=lambda x: x[0])
    for var_name, var_value in all_vars:
        log += ("\n\t%-20s %s" % (var_name, var_value))
    print log
    if path is not None:
        ensure_dir(path)
        # Don't override, just append if by mistake there is something in the file.
        with open(os.path.join(path, __model_setting_file_name), 'a+') as f:
            f.write(log)
        if sys_arg:
            with open(os.path.join(path, 'th_conf.txt'), 'a+') as f:
                f.write(str(theano.config))
            with open(os.path.join(path, 'args.pkl'), 'wb') as f:
                pickle.dump(sys.argv, f)
                # To load:
                # >>> import cPickle as pickle
                # >>> args = pickle.load(open(os.path.join(path, 'args.pkl'), 'rb'))