提交 1f093755 authored 作者: David Warde-Farley's avatar David Warde-Farley

TST: use TensorConstant for Variable shape tests

This makes the tests pass but nosetests still segfaults.
上级 088f574f
...@@ -14,19 +14,17 @@ def check_uniform_basic(shape_as_theano_variable, ...@@ -14,19 +14,17 @@ def check_uniform_basic(shape_as_theano_variable,
dim_as_theano_variable=False): dim_as_theano_variable=False):
rng = CURAND_RandomStreams(234) rng = CURAND_RandomStreams(234)
if shape_as_theano_variable: if shape_as_theano_variable:
shape = specify_shape(vector(dtype='int64'), (2,)) shape = constant((10, 10))
givens = {shape: (10, 10)}
else: else:
if dim_as_theano_variable: if dim_as_theano_variable:
shape = (10, constant(10)) shape = (10, constant(10))
else: else:
shape = (10, 10) shape = (10, 10)
givens = {}
u0 = rng.uniform(shape) u0 = rng.uniform(shape)
u1 = rng.uniform(shape) u1 = rng.uniform(shape)
f0 = theano.function([], u0, mode=mode_with_gpu, givens=givens) f0 = theano.function([], u0, mode=mode_with_gpu)
f1 = theano.function([], u1, mode=mode_with_gpu, givens=givens) f1 = theano.function([], u1, mode=mode_with_gpu)
v0list = [f0() for i in range(3)] v0list = [f0() for i in range(3)]
v1list = [f1() for i in range(3)] v1list = [f1() for i in range(3)]
...@@ -56,19 +54,17 @@ def check_normal_basic(shape_as_theano_variable, ...@@ -56,19 +54,17 @@ def check_normal_basic(shape_as_theano_variable,
dim_as_theano_variable=False): dim_as_theano_variable=False):
rng = CURAND_RandomStreams(234) rng = CURAND_RandomStreams(234)
if shape_as_theano_variable: if shape_as_theano_variable:
shape = specify_shape(vector(dtype='int64'), (2,)) shape = constant((10, 10))
givens = {shape: (10, 10)}
else: else:
if dim_as_theano_variable: if dim_as_theano_variable:
shape = (10, constant(10)) shape = (10, constant(10))
else: else:
shape = (10, 10) shape = (10, 10)
givens = {}
u0 = rng.normal(shape) u0 = rng.normal(shape)
u1 = rng.normal(shape) u1 = rng.normal(shape)
f0 = theano.function([], u0, mode=mode_with_gpu, givens=givens) f0 = theano.function([], u0, mode=mode_with_gpu)
f1 = theano.function([], u1, mode=mode_with_gpu, givens=givens) f1 = theano.function([], u1, mode=mode_with_gpu)
v0list = [f0() for i in range(3)] v0list = [f0() for i in range(3)]
v1list = [f1() for i in range(3)] v1list = [f1() for i in range(3)]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论