Skip to content

Commit ee263d1

Browse files
committed
make the rbm code work in float32.
1 parent a8ee2e6 commit ee263d1

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

code/rbm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(self, input=None, n_visible=784, n_hidden=500, \
8484
# initialize input layer for standalone RBM or layer0 of DBN
8585
self.input = input
8686
if not input:
87-
self.input = T.dmatrix('input')
87+
self.input = T.matrix('input')
8888

8989
self.W = W
9090
self.hbias = hbias
@@ -341,7 +341,7 @@ def test_rbm(learning_rate=0.1, training_epochs = 15,
341341
theano_rng = RandomStreams( rng.randint(2**30))
342342

343343
# initialize storage for the persistent chain (state = hidden layer of chain)
344-
persistent_chain = theano.shared(numpy.zeros((batch_size, 500)))
344+
persistent_chain = theano.shared(numpy.zeros((batch_size, 500),dtype=theano.config.floatX))
345345

346346
# construct the RBM class
347347
rbm = RBM( input = x, n_visible=28*28, \

code/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def speed():
5252

5353
expected_times_64=numpy.asarray([ 12.42313051, 28.09523582, 106.35365391, 153.62705898, 153.12310314, 425.09175086, 642.72824597, 652.52828193])
5454
expected_times_32=numpy.asarray([ 13.29699826, 32.42813158, 68.03559947, 142.51003361, 107.00527334,
55-
242.41721797, 490.40798998,float('NaN')])
55+
242.41721797, 490.40798998, 528.88854146])
5656
def time_test(m,l,idx,f,**kwargs):
5757
if not to_exec[idx]:
5858
l[idx]=float('nan')

0 commit comments

Comments
 (0)