提交 4507bc53 authored 作者: Benjamin Scellier's avatar Benjamin Scellier 提交者: Nicolas Ballas

file theano/gof/tests/test_link.py

上级 4bf5d362
...@@ -2,7 +2,7 @@ from __future__ import absolute_import, print_function, division ...@@ -2,7 +2,7 @@ from __future__ import absolute_import, print_function, division
from copy import deepcopy from copy import deepcopy
import unittest import unittest
import numpy import numpy as np
import theano import theano
from theano.gof import graph from theano.gof import graph
...@@ -203,18 +203,18 @@ def test_container_deepcopy(): ...@@ -203,18 +203,18 @@ def test_container_deepcopy():
# It seam that numpy.asarray(0.).astype(floatX) can return a numpy # It seam that numpy.asarray(0.).astype(floatX) can return a numpy
# scalar with some NumPy Version. So we call numpy.asarray with # scalar with some NumPy Version. So we call numpy.asarray with
# the dtype parameter. # the dtype parameter.
v = numpy.asarray(0., dtype=theano.config.floatX) v = np.asarray(0., dtype=theano.config.floatX)
assert isinstance(v, numpy.ndarray), type(v) assert isinstance(v, np.ndarray), type(v)
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), (c.storage[0], assert isinstance(c.storage[0], np.ndarray), (c.storage[0],
type(c.storage[0])) type(c.storage[0]))
assert c.storage[0].dtype == v.dtype, (c.storage[0].dtype, v.dtype) assert c.storage[0].dtype == v.dtype, (c.storage[0].dtype, v.dtype)
assert c.storage[0].dtype == c.type.dtype, (c.storage[0].dtype, assert c.storage[0].dtype == c.type.dtype, (c.storage[0].dtype,
c.type.dtype) c.type.dtype)
d = deepcopy(c) d = deepcopy(c)
assert isinstance(d.storage[0], numpy.ndarray), (d.storage[0], assert isinstance(d.storage[0], np.ndarray), (d.storage[0],
type(d.storage[0])) type(d.storage[0]))
assert d.storage[0].dtype == v.dtype, (d.storage[0].dtype, v.dtype) assert d.storage[0].dtype == v.dtype, (d.storage[0].dtype, v.dtype)
assert d.storage[0].dtype == c.type.dtype, (d.storage[0].dtype, assert d.storage[0].dtype == c.type.dtype, (d.storage[0].dtype,
c.type.dtype) c.type.dtype)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论