Undoing some of the previous commit (only wanted to commit sparse/basic.py).

Please be careful when committing ;)
上级 34108879
......@@ -865,6 +865,7 @@ class _Linker(gof.link.LocalLinker):
for r in node.outputs:
if not r.type.is_valid_value(storage_map[r][0]):
raise InvalidValueError(r, storage_map[r][0])
#if r in r_vals:
_check_inputs(node, storage_map, r_vals, dr_vals, active_order_set,
clobber_dr_vals=True)
......
......@@ -172,15 +172,3 @@ class RandomStreams(Component):
"""
return self.gen(raw_random.random_integers, *args, **kwargs)
randstream_singleton = []
def getRandomStream(seed=None, force_new=False):
global randstream_singleton
if force_new or not randstream_singleton:
print 'creating random stream with seed %i' % seed
randstream_singleton = []
randstream_singleton.append(RandomStreams(seed))
elif seed:
print >> sys.stderr, 'Warning: RandomStream singleton already instantiated. Seed %i will be ignored'%seed
return randstream_singleton[0]
......@@ -3,10 +3,10 @@ __docformat__ = "restructuredtext en"
import sys
import unittest
import numpy
from theano.tensor.randomstreams import RandomStreams, raw_random, getRandomStream, randstream_singleton
from theano.tensor.randomstreams import RandomStreams, raw_random
from theano.compile import Module, Method, Member
import theano
from theano import tensor
from theano import compile, gof
......@@ -139,40 +139,6 @@ class T_RandomStreams(unittest.TestCase):
def test_singleton(self):
moda = Module()
moda.randa = getRandomStream(12)
a = moda.randa.uniform((2,2))
moda.fn = Method([], a)
imoda = moda.make()
imoda.randa.initialize()
modb = Module()
modb.randb = getRandomStream()
b = modb.randb.uniform((2,2))
modb.fn = Method([], b)
imodb = modb.make()
imodb.randb.initialize()
avals1 = imoda.fn()
bvals1 = imodb.fn()
modc = Module()
modc.randc = getRandomStream(12, force_new=True)
a2 = modc.randc.uniform((2,2))
b2 = modc.randc.uniform((2,2))
modc.fna = Method([], a2)
modc.fnb = Method([], b2)
imodc = modc.make()
imodc.randc.initialize()
avals2 = imodc.fna()
bvals2 = imodc.fnb()
assert (avals1 == avals2).all()
assert (bvals1 == bvals2).all()
if __name__ == '__main__':
from theano.tests import main
main("test_randomstreams")
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论