提交 90f9614b authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Remove use of generators in default flags.

上级 332d2fd7
...@@ -3,7 +3,6 @@ from __future__ import print_function ...@@ -3,7 +3,6 @@ from __future__ import print_function
# as False, and the string s'True', 'true', '1' as True. # as False, and the string s'True', 'true', '1' as True.
# We also accept the bool type as its corresponding value! # We also accept the bool type as its corresponding value!
import inspect
import logging import logging
import os import os
import shlex import shlex
...@@ -306,11 +305,7 @@ class ConfigParam(object): ...@@ -306,11 +305,7 @@ class ConfigParam(object):
try: try:
val_str = fetch_val_for_key(self.fullname) val_str = fetch_val_for_key(self.fullname)
except KeyError: except KeyError:
if inspect.isgeneratorfunction(self.default): if callable(self.default):
for v in self.default():
val_str = v
self.__set__(None, val_str)
elif callable(self.default):
val_str = self.default() val_str = self.default()
else: else:
val_str = self.default val_str = self.default
......
...@@ -162,37 +162,6 @@ _logger = logging.getLogger('theano.tensor.blas') ...@@ -162,37 +162,6 @@ _logger = logging.getLogger('theano.tensor.blas')
# We need to define blas.ldflag before we try to import scipy. # We need to define blas.ldflag before we try to import scipy.
# Otherwise, we give an optimization warning for no reason in some cases. # Otherwise, we give an optimization warning for no reason in some cases.
def default_blas_ldflags(): def default_blas_ldflags():
"""This is a generator. It work in 2 step. The first we guess a
default blas, then we test it. If it fail, we return an empty
blas.
This is needed for Anaconda on Windows. I wasn't able to find how
to detect if the mkl from Anaconda can be reused or not. I was not
able to find a way to test it with try_flags correctly. Also, this
will test the real code, so we do not need to update the test in
case the software change. This also enables the test for all
cases.
"""
flags = static_default_blas_flags()
yield flags
# Now test it!
try:
old = config.compute_test_value
config.compute_test_value = 'off'
x = theano.tensor.fmatrix()
try:
theano.function([x], theano.tensor.blas._dot22(x, x),
profile=False)
except Exception as e:
print(e)
yield ""
finally:
config.compute_test_value = old
def static_default_blas_flags():
try: try:
if (hasattr(numpy.distutils, '__config__') and if (hasattr(numpy.distutils, '__config__') and
numpy.distutils.__config__): numpy.distutils.__config__):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论