提交 680a3593 authored 作者: Frederic's avatar Frederic

Fix another test when floatX=float32.

上级 4bd637ea
...@@ -3,6 +3,7 @@ import unittest ...@@ -3,6 +3,7 @@ import unittest
import numpy import numpy
import theano
from theano.gof import graph from theano.gof import graph
from theano.gof.graph import Variable, Apply, Constant from theano.gof.graph import Variable, Apply, Constant
from theano.gof.type import Type from theano.gof.type import Type
...@@ -192,9 +193,13 @@ def test_container_deepcopy(): ...@@ -192,9 +193,13 @@ def test_container_deepcopy():
This is a test to a work around a NumPy bug. This is a test to a work around a NumPy bug.
""" """
t = theano.tensor.scalar() t = theano.tensor.scalar()
v = numpy.asarray(0.) v = numpy.asarray(0.).astype(theano.config.floatX)
for readonly in [True, False]: for readonly in [True, False]:
c = Container(t, [v], readonly=readonly) c = Container(t, [v], readonly=readonly)
assert isinstance(c.storage[0], numpy.ndarray) assert isinstance(c.storage[0], numpy.ndarray)
assert c.storage[0].dtype == v.dtype
assert c.storage[0].dtype == c.type.dtype
d = deepcopy(c) d = deepcopy(c)
assert isinstance(d.storage[0], numpy.ndarray) assert isinstance(d.storage[0], numpy.ndarray)
assert c.storage[0].dtype == v.dtype
assert c.storage[0].dtype == c.type.dtype
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论