当前位置: 首页>>代码示例>>Python>>正文


Python theano.__version__方法代码示例

本文整理汇总了Python中theano.__version__方法的典型用法代码示例。如果您正苦于以下问题:Python theano.__version__方法的具体用法?Python theano.__version__怎么用?Python theano.__version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在theano的用法示例。


在下文中一共展示了theano.__version__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _show_system_info

# 需要导入模块: import theano [as 别名]
# 或者: from theano import __version__ [as 别名]
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() 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:9,代码来源:main.py

示例2: log_keras_version_info

# 需要导入模块: import theano [as 别名]
# 或者: from theano import __version__ [as 别名]
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 
开发者ID:allenai,项目名称:deep_qa,代码行数:17,代码来源:checks.py

示例3: print_model_settings

# 需要导入模块: import theano [as 别名]
# 或者: from theano import __version__ [as 别名]
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')) 
开发者ID:soroushmehr,项目名称:sampleRNN_ICLR2017,代码行数:62,代码来源:__init__.py


注:本文中的theano.__version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。