blei-lab / edward

A probabilistic programming language in TensorFlow. Deep generative models, variational inference.
http://edwardlib.org
Other
4.83k stars 761 forks source link

MAP.update doesn't work after edward and tensorflow upgrade #629

Closed mariru closed 7 years ago

mariru commented 7 years ago

get the following error after upgrading to edward version 1.3.1 and tensorflow version 1.1.0

File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 778, in run
run_metadata_ptr)
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 969, in _run
fetch_handler = _FetchHandler(self._graph, fetches, feed_dict_string)
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 408, in init
self._fetch_mapper = _FetchMapper.for_fetch(fetches)
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 230, in for_fetch
return _ListFetchMapper(fetch)
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 337, in init
self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 238, in for_fetch
return _ElementFetchMapper(fetches, contraction_fn)
File "/home/maja/.local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 271, in init
% (fetch, type(fetch), str(e)))
TypeError: Fetch argument <bound method MAP.update of <edward.inferences.map.MAP object at 0x7f10f7044d50>> has invalid type <type 'instancemethod'>, must be a string or Tensor. (Can not convert a instancemethod into a Tensor or Operation.)
mariru commented 7 years ago

Figured it out. It used to be unnecessary to explicitly call inference.initialize() for MAP. I fixed the error above by adding it to my script.