本文整理匯總了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()
示例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
示例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'))