Skip to content

Commit ad93036

Browse files
committed
Remove .value in SdA
1 parent de0598b commit ad93036

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

code/SdA.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def pretraining_functions(self, train_set_x, batch_size):
186186
corruption_level = T.scalar('corruption') # amount of corruption to use
187187
learning_rate = T.scalar('lr') # learning rate to use
188188
# number of batches
189-
n_batches = train_set_x.value.shape[0] / batch_size
189+
n_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
190190
# begining of a batch, given `index`
191191
batch_begin = index * batch_size
192192
# ending of a batch given `index`
@@ -234,8 +234,8 @@ def build_finetune_functions(self, datasets, batch_size, learning_rate):
234234
(test_set_x , test_set_y ) = datasets[2]
235235

236236
# compute number of minibatches for training, validation and testing
237-
n_valid_batches = valid_set_x.value.shape[0] / batch_size
238-
n_test_batches = test_set_x.value.shape[0] / batch_size
237+
n_valid_batches = valid_set_x.get_value(borrow=True).shape[0] / batch_size
238+
n_test_batches = test_set_x.get_value(borrow=True).shape[0] / batch_size
239239

240240
index = T.lscalar('index') # index to a [mini]batch
241241

@@ -313,7 +313,7 @@ def test_SdA( finetune_lr = 0.1, pretraining_epochs = 15, \
313313

314314

315315
# compute number of minibatches for training, validation and testing
316-
n_train_batches = train_set_x.value.shape[0] / batch_size
316+
n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
317317

318318
# numpy random generator
319319
numpy_rng = numpy.random.RandomState(89677)

doc/SdA.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ during training we associate a Theano variable to them.
238238
corruption_level = T.scalar('corruption') # amount of corruption to use
239239
learning_rate = T.scalar('lr') # learning rate to use
240240
# number of batches
241-
n_batches = train_set_x.value.shape[0] / batch_size
241+
n_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
242242
# begining of a batch, given `index`
243243
batch_begin = index * batch_size
244244
# ending of a batch given `index`
@@ -298,8 +298,8 @@ during finetuning ( a ``train_model``, a ``validate_model`` and a
298298
(test_set_x , test_set_y ) = datasets[2]
299299

300300
# compute number of minibatches for training, validation and testing
301-
n_valid_batches = valid_set_x.value.shape[0] / batch_size
302-
n_test_batches = test_set_x.value.shape[0] / batch_size
301+
n_valid_batches = valid_set_x.get_value(borrow=True).shape[0] / batch_size
302+
n_test_batches = test_set_x.get_value(borrow=True).shape[0] / batch_size
303303

304304
index = T.lscalar('index') # index to a [mini]batch
305305

0 commit comments

Comments
 (0)