Hi,

borrow=True is an indication that the internal value _can_ be returned,
but it is not a guarantee that it _will_ be.
Therefore, the better way is to explicitly re-assign the value calling
set_value, which is guaranteed to work.

On Thu, Oct 27, 2016, pietro galliani wrote:
> Apologies if I am misunderstanding something or this is not the correct 
> venue, but I believe I found a small mistake in the deeplearning.net theano 
> tutorial. 
> 
> In the "Seeding Streams" section of the "More Examples" section, it is 
> written the following:
> 
> Random variables can be seeded individually or collectively.
> 
> You can seed just one random variable by seeding or assigning to the .rng 
> attribute, 
> using .rng.set_value().
> 
> >>> rng_val = rv_u.rng.get_value(borrow=True)   # Get the rng for rv_u>>> 
> >>> rng_val.seed(89234)                         # seeds the generator>>> 
> >>> rv_u.rng.set_value(rng_val, borrow=True)    # Assign back seeded rng
> 
> 
> 
> Now, it seems to me that using rng.set_value is entirely superfluous here: 
> since we used borrow=True with get_value, rng_val is the random state of 
> the (uniform, in this case) random function rv_u and NOT a copy, and, thus, 
> there is no need to assigning it back to it after seeding it. This would be 
> different, of course, if we had used borrow=False. 
> 
> A couple of quick tests seem to confirm my impression. Am I missing 
> something? 
> 
> Thanks!
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "theano-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to theano-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


-- 
Pascal

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to