Pass random variable as numpy array

How do I handle a case such as

y = Normal(loc=function(a,b,c),scale=tf.ones(N))

Where my “function” requires numpy array inputs but “a,b,c” are Random Variables?

I’ve tried using the eval() method but my posterior never changes if I do that.


With eval(), the NumPy function is only evaluated once. It outputs loc parameters to the normal random variable and is a constant NumPy array.

If you’d like y's location parameter to change across session runs, the function has to be part of the computational graph (i.e., written in TensorFlow).

Thank you for the quick response, that makes sense.

The function I’m trying to evaluate is a Keras deep network. Do you know, by any chance, if it is possible to pass tensorflow variables to a Keras deep network? I haven’t been able but maybe there’s a way.