tensorprob / tensorprob

:chart_with_upwards_trend: A probabilistic programming framework based on TensorFlow
https://tensorprob.github.io/tensorprob
MIT License
87 stars 19 forks source link

tensorflow select deprecated? #80

Open seneubert opened 7 years ago

seneubert commented 7 years ago

Trying to run the examples with tensorflow 1.0.1 produces the following error. Might this be due to some deprecated function usage?

AttributeError                            Traceback (most recent call last)
<ipython-input-3-261cf6a9cf81> in <module>()
      3     sigma = Parameter(lower=0)
      4 
----> 5     X = Normal(mu, sigma)
      6 
      7 model.observed(X)

<ipython-input-3-261cf6a9cf81> in <module>()
      1 with Model() as model:
      2     mu = Parameter()
----> 3     sigma = Parameter(lower=0)
      4 
      5     X = Normal(mu, sigma)

/home/sneubert/Projects/tensorprob/tensorprob/distribution.py in f(*args, **kwargs)
    103         # Force logp to negative infinity when outside the allowed bounds
    104         for var, bound in zip(variables, bounds):
--> 105             logp = utilities.set_logp_to_neg_inf(var, logp, bound)
    106 
    107         # Add the new variables to the model description

/home/sneubert/Projects/tensorprob/tensorprob/utilities.py in set_logp_to_neg_inf(X, logp, bounds)
    104             is_inside_bounds = tf.logical_or(is_inside_bounds, condition)
    105 
--> 106         logp = tf.select(
    107             is_inside_bounds,
    108             logp,

AttributeError: 'module' object has no attribute 'select'
chrisburr commented 7 years ago

I think tf.select has been replaced with tf.where. I can try swapping it later today (and update Travis to test against a newer version of tensorflow).

seneubert commented 7 years ago

Great, that would be nice! Thanks

seneubert commented 7 years ago

I can confirm, tf.where cures this. However there seem to be many more issues with the uptodate tensorflow