提交 f430aa8b authored 作者: abalkin's avatar abalkin

Issue #783: python3 compatible - fixed batched_dot

- disabled fix_filter becaus theano uses "filter" as a method name; - fixed another instance of checking the error message; - fixed another instance affected by numpy isinstance(x, int) bug.
上级 19958033
...@@ -14,17 +14,17 @@ try: ...@@ -14,17 +14,17 @@ try:
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
try: try:
from distutils.util import Mixin2to3 from distutils.command.build_py import build_py_2to3 as build_py
from lib2to3.refactor import get_fixers_from_package
Mixin2to3.fixer_names = [f for f in get_fixers_from_package('lib2to3.fixes')
if f != 'lib2to3.fixes.fix_next']
from distutils.command.build_py import build_py_2to3 \
as build_py
from distutils.command.build_scripts import build_scripts_2to3 \
as build_scripts
except ImportError: except ImportError:
from distutils.command.build_py import build_py from distutils.command.build_py import build_py
from distutils.command.build_scripts import build_scripts from distutils.command.build_scripts import build_scripts
else:
exclude_fixers = ['fix_next', 'fix_filter']
from distutils.util import Mixin2to3
from lib2to3.refactor import get_fixers_from_package
Mixin2to3.fixer_names = [f for f in get_fixers_from_package('lib2to3.fixes')
if f.rsplit('.', 1)[-1] not in exclude_fixers]
from distutils.command.build_scripts import build_scripts_2to3 as build_scripts
CLASSIFIERS = """\ CLASSIFIERS = """\
......
...@@ -4113,8 +4113,9 @@ class Subtensor(Op): ...@@ -4113,8 +4113,9 @@ class Subtensor(Op):
slice_c = None slice_c = None
return slice(slice_a, slice_b, slice_c) return slice(slice_a, slice_b, slice_c)
# There is a bug in numpy that results in isinstance(x, int) returning False for numpy integers.
elif isinstance(entry, int): # See <http://projects.scipy.org/numpy/ticket/2235>.
elif isinstance(entry, (numpy.integer, int)):
return entry return entry
else: else:
raise AdvancedIndexingError(Subtensor.e_indextype, entry) raise AdvancedIndexingError(Subtensor.e_indextype, entry)
......
...@@ -2661,7 +2661,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin): ...@@ -2661,7 +2661,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
self.eval_output_and_check(t) self.eval_output_and_check(t)
assert 0 assert 0
except Exception, e: except Exception, e:
if e[0] != 'index out of bounds': if exc_message(e) != 'index out of bounds':
raise raise
finally: finally:
_logger.setLevel(oldlevel) _logger.setLevel(oldlevel)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论