You can generate random tensors in Theano:

    from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams

    srng = RandomStreams()       # change the seed if you want

    .
    .
    .

    R1 = srng.normal(shape)
    R2 = srng.normal(shape)
    .
    .
    .



On Saturday, February 25, 2017 at 12:49:18 PM UTC+1, Asghar Inanlou Asl 
wrote:
>
> Hi all,
> I need to make a shared variable and randomly initialize it. Obviously, 
> the way to do it is to use numpy to generate a random matrix and then 
> change it to shared variable via theano.shared()
> However, I cannot do it because the size of the random matrix is partly 
> coming from a TensorVariable so numpy gets stuck in it.
> To be particular, I have a function which multiplies the input tensor in a 
> random matrix (think about what a fully connected layer does). But the 
> point is the shape of the tensor might be changing. And it needs to be a 
> shared variable to that I can use it as one of the parameters of my updates.
> Any comments?
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to