提交 e2a0f608 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1411 from nouiz/py3

Fix import of compat module in python 3.3.0
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
# Python 3.x compatibility # Python 3.x compatibility
from theano.compat.six import PY3, b, BytesIO, next, get_unbound_function from theano.compat.six import PY3, b, BytesIO, next, get_unbound_function
from theano.compat.six.moves import reload_module as reload, configparser from theano.compat.six.moves import configparser
from theano.compat.six.moves import reload_module as reload
if PY3: if PY3:
......
...@@ -49,7 +49,7 @@ def test_optimizer(): ...@@ -49,7 +49,7 @@ def test_optimizer():
f = theano.function([x], [theano.tensor.log(x) * x], f = theano.function([x], [theano.tensor.log(x) * x],
mode=mode) mode=mode)
# Test that the fusion wasn't done # Test that the fusion wasn't done
assert len(f.maker.fgraph.nodes) == 2 assert len(f.maker.fgraph.apply_nodes) == 2
f(0) # log(0) * 0 = -inf * 0 = NaN f(0) # log(0) * 0 = -inf * 0 = NaN
# Test that we still detect the nan # Test that we still detect the nan
...@@ -83,7 +83,7 @@ def test_not_inplace(): ...@@ -83,7 +83,7 @@ def test_not_inplace():
mode=mode) mode=mode)
# Test that the fusion wasn't done # Test that the fusion wasn't done
assert len(f.maker.fgraph.nodes) == 5 assert len(f.maker.fgraph.apply_nodes) == 5
assert not f.maker.fgraph.toposort()[-1].op.destroy_map assert not f.maker.fgraph.toposort()[-1].op.destroy_map
f([0, 0]) # log(0) * 0 = -inf * 0 = NaN f([0, 0]) # log(0) * 0 = -inf * 0 = NaN
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论