提交 186360ce authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Move the test for DeepCopyOp to a new test_type.py file since its code is defined in type.py.

上级 5e1935ba
...@@ -5,7 +5,6 @@ from copy import copy, deepcopy ...@@ -5,7 +5,6 @@ from copy import copy, deepcopy
import numpy import numpy
import theano import theano
import theano.tensor as T import theano.tensor as T
from theano.compile import DeepCopyOp
from theano.tensor.tests.test_basic import safe_make_node from theano.tensor.tests.test_basic import safe_make_node
from theano.tests.unittest_tools import SkipTest from theano.tests.unittest_tools import SkipTest
from numpy.testing.noseclasses import KnownFailureTest from numpy.testing.noseclasses import KnownFailureTest
...@@ -317,15 +316,3 @@ GpuAllocTester = makeTester( ...@@ -317,15 +316,3 @@ GpuAllocTester = makeTester(
bad_shape12=(rand_gpuarray(7), numpy.int32(7), numpy.int32(5)), bad_shape12=(rand_gpuarray(7), numpy.int32(7), numpy.int32(5)),
) )
) )
def test_deep_copy():
a = rand_gpuarray(20, dtype='float32')
g = GpuArrayType(dtype='float32', broadcastable=(False,))('g')
f = theano.function([g], g)
assert isinstance(f.maker.fgraph.toposort()[0].op, DeepCopyOp)
res = f(a)
assert GpuArrayType.values_eq(res, a)
import operator
import theano
from theano.compile import DeepCopyOp
from theano.sandbox.gpuarray.tests.test_basic_ops import rand_gpuarray
from theano.sandbox.gpuarray.type import GpuArrayType
def test_deep_copy():
a = rand_gpuarray(20, dtype='float32')
g = GpuArrayType(dtype='float32', broadcastable=(False,))('g')
f = theano.function([g], g)
assert isinstance(f.maker.fgraph.toposort()[0].op, DeepCopyOp)
res = f(a)
assert GpuArrayType.values_eq(res, a)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论