InvalidArgumentError while running conditioning on Edward

#1

Hi, I’m new to Edward and getting stuck at this issue.

import edward as ed
import six
import tensorflow as tf
from edward.models import Bernoulli, Beta
unknown = Beta(concentration1=1.0, concentration0=1.0)
c = Bernoulli(probs=unknown, sample_shape = 100)
cond = ed.complete_conditional(unknown)
prob_post = ed.copy(cond, {c:lit_abs}) # lit_abs is a np array with shape (100,) with 1's and 0's in it
sess.run({key:val for key, val in six.iteritems(prob_post.parameters) if isinstance(val, tf.Tensor)})
InvalidArgumentError                      Traceback (most recent call last)
 in ()
      2 cond = ed.complete_conditional(unknown)
      3 prob_post = ed.copy(cond, {c:np.asarray(lit_abs)})
----> 4 sess.run({key:val for key, val in six.iteritems(prob_post.parameters) if isinstance(val, tf.Tensor)})

/home/uname/.local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in run(self, fetches, feed_dict, options, run_metadata)
    903     try:
    904       result = self._run(None, fetches, feed_dict, options_ptr,
--> 905                          run_metadata_ptr)
    906       if run_metadata:
    907         proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)

/home/uname/.local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _run(self, handle, fetches, feed_dict, options, run_metadata)
   1135     if final_fetches or final_targets or (handle and feed_dict_tensor):
   1136       results = self._do_run(handle, final_targets, final_fetches,
-> 1137                              feed_dict_tensor, options, run_metadata)
   1138     else:
   1139       results = []

/home/uname/.local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_run(self, handle, target_list, fetch_list, feed_dict, options, run_metadata)
   1353     if handle is None:
   1354       return self._do_call(_run_fn, self._session, feeds, fetches, targets,
-> 1355                            options, run_metadata)
   1356     else:
   1357       return self._do_call(_prun_fn, self._session, handle, feeds, fetches)

/home/uname/.local/lib/python2.7/site-packages/tensorflow/python/client/session.pyc in _do_call(self, fn, *args)
   1372         except KeyError:
   1373           pass
-> 1374       raise type(e)(node_def, op, message)
   1375 
   1376   def _extend_graph(self):

InvalidArgumentError: Input 0 of node copied/complete_conditional_Beta_2/1554456706.32swapback/complete_conditional_Beta_2/1554456706.32swap/conjugate_log_joint/Cast_1 was passed int64 from Const_3:0 incompatible with expected int32.
0 Likes