提交 9c0e1eac authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

merge

...@@ -8,7 +8,7 @@ http://www.iro.umontreal.ca/~simardr/ssj/indexe.html ...@@ -8,7 +8,7 @@ http://www.iro.umontreal.ca/~simardr/ssj/indexe.html
import sys import sys
import numpy import numpy
from theano import Op, Apply, shared, config from theano import Op, Apply, shared, config, Variable
from theano.tensor import raw_random, TensorType, as_tensor_variable, get_vector_length, cast, opt from theano.tensor import raw_random, TensorType, as_tensor_variable, get_vector_length, cast, opt
from theano.tensor import zeros_like, sqrt, log, sin, cos, join from theano.tensor import zeros_like, sqrt, log, sin, cos, join
from theano.compile import optdb from theano.compile import optdb
...@@ -627,11 +627,14 @@ class MRG_RandomStreams(object): ...@@ -627,11 +627,14 @@ class MRG_RandomStreams(object):
ndim may be a plain integer to supplement the missing ndim may be a plain integer to supplement the missing
information. information.
Currently size can't be None. Otherwise it fail later. So I added the assert :param: size: Can be a list of integer or a Theano variable like the shape of some tensor.
The number of dimensions must be computable at compile time.
TODO: can size be None?
""" """
assert isinstance(size, tuple), "size must be a tuple" if isinstance(size, tuple):
assert all([isinstance(i,int) for i in size]) assert all([isinstance(i,int) for i in size]), "size must be a tuple of int or a Theano variable"
else: assert isinstance(size, Variable), "size must be a tuple of int or a Theano variable"
if nstreams is None: if nstreams is None:
nstreams = self.n_streams(size) nstreams = self.n_streams(size)
if self.use_cuda and dtype=='float32': if self.use_cuda and dtype=='float32':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论