提交 164d7fdb authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixed crash when theano.version does not exist

This is the case for instance when someone directly uses the git repository without running setup.py.
上级 c6fc9734
...@@ -41,6 +41,15 @@ import configparser, configdefaults ...@@ -41,6 +41,15 @@ import configparser, configdefaults
config = configparser.TheanoConfigParser() config = configparser.TheanoConfigParser()
# Version information.
# Note that the version must be defined before imports below as it is used by
# some of these imports.
try:
import theano.version
__version__ = theano.version.version
except ImportError:
__version__ = "unknown"
import gof import gof
from gof import \ from gof import \
...@@ -142,11 +151,3 @@ def dot(l, r): ...@@ -142,11 +151,3 @@ def dot(l, r):
if rval == NotImplemented: if rval == NotImplemented:
raise NotImplementedError("Dot failed for the following reasons:", (e0, e1)) raise NotImplementedError("Dot failed for the following reasons:", (e0, e1))
return rval return rval
# Version information
try:
import theano.version
__version__ = theano.version.version
except ImportError:
__version__ = "unknown"
...@@ -6,7 +6,6 @@ import re ...@@ -6,7 +6,6 @@ import re
import sys import sys
import theano import theano
import theano.version
from theano.configparser import config, AddConfigVar, ConfigParam, StrParam from theano.configparser import config, AddConfigVar, ConfigParam, StrParam
...@@ -15,7 +14,7 @@ def default_compiledirname(): ...@@ -15,7 +14,7 @@ def default_compiledirname():
platform.platform(), platform.platform(),
platform.processor(), platform.processor(),
platform.python_version(), platform.python_version(),
theano.version.version]) theano.__version__])
platform_id = re.sub("[\(\)\s,]+", "_", platform_id) platform_id = re.sub("[\(\)\s,]+", "_", platform_id)
return 'compiledir_' + platform_id return 'compiledir_' + platform_id
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论