提交 c138cdf5 authored 作者: Frederic's avatar Frederic

Make CURAND op use False as the original input and not None.

This lift one of the multiple problem that prevent the use of DebugMode.
上级 4c42fbff
......@@ -24,7 +24,7 @@ class CURAND_Base(theano.gof.Op):
This Op uses a generic-typed shared variable to point to a CObject that
encapsulates this opaque reference.
Each random variable is created with a generator of None.
Each random variable is created with a generator of False.
The actual random number generator is allocated from the seed, on the first
call to allocate random numbers (see c_code).
......@@ -189,7 +189,7 @@ class CURAND_Base(theano.gof.Op):
%(fail)s;
}
%(o_generator)s = PyCObject_FromVoidPtr(gen, &free_generator);
assert (%(i_generator)s == Py_None);
assert (%(i_generator)s == Py_False);
}
else if (%(destructive)s)
{
......@@ -219,7 +219,7 @@ class CURAND_Base(theano.gof.Op):
""" %locals()
def c_code_cache_version(self):
return (1,)
return (2,)
class CURAND_Normal(CURAND_Base):
......@@ -288,7 +288,7 @@ class CURAND_RandomStreams(object):
else:
msg = "size must be a tuple of int or a Theano variable"
assert isinstance(size, Variable) and size.ndim==1, msg
generator = theano.shared(None) #makes a generic
generator = theano.shared(False) #makes a generic
s_size = theano.tensor.as_tensor_variable(size)
u = CURAND_Uniform.new_auto_update(generator, ndim, dtype, s_size,
self.next_seed())
......@@ -312,7 +312,7 @@ class CURAND_RandomStreams(object):
else:
msg = "size must be a tuple of int or a Theano variable"
assert isinstance(size, Variable) and size.ndim==1, msg
generator = theano.shared(None) #makes a generic
generator = theano.shared(False) #makes a generic
s_size = theano.tensor.as_tensor_variable(size)
u = CURAND_Normal.new_auto_update(generator, ndim, dtype, s_size,
self.next_seed())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论