Reputation: 28032
I see this following line of code:
n_train_batches = train_set_x.get_value(borrow=True).shape[0] / batch_size
In the above line, what is the borrow parameter exactly? What is the advantage of adding that there? FYI, train_set_x is basically a matrix that was generated using the theano.shared method.
Upvotes: 4
Views: 1079
Reputation: 400109
This part of the documentation seems relevant:
By default (
s_default
) and when explicitly settingborrow=False
, the shared variable we construct gets a deep copy of np_array. So changes we subsequently make tonp_array
have no effect on our shared variable.
Setting it to True
can then be assumed to make a shallow copy, effectively letting you "borrow" access to the memory.
Upvotes: 6