{"action":"created","comment":{"url":"https://api.github.com/repos/blei-lab/edward/pulls/comments/174692433","pull_request_review_id":104092670,"id":174692433,"diff_hunk":"@@ -54,26 +54,23 @@ def __init__(self, latent_vars, proposal_vars, data=None,\n     \"\"\"\n     check_latent_vars(proposal_vars)\n     self.proposal_vars = proposal_vars\n+    super(ReplicaExchangeMC, self).__init__(latent_vars, data)\n \n     self.n_replica = len(inverse_temperatures)\n     if inverse_temperatures[0] != 1:\n       raise ValueError(\"inverse_temperatures[0] must be 1.\")\n-    self.inverse_temperatures = [tf.convert_to_tensor(inverse_temperature,\n-                                 dtype=list(latent_vars.values())[0].dtype)\n-                                 for inverse_temperature in\n-                                 inverse_temperatures]\n+    self.inverse_temperatures = tf.constant(","path":"edward/inferences/replica_exchange_mc.py","position":22,"original_position":22,"commit_id":"c06f005f115c233f9b48b9de4621136d2c7d982a","original_commit_id":"c06f005f115c233f9b48b9de4621136d2c7d982a","user":{"login":"dustinvtran","id":2569867,"avatar_url":"https://avatars1.githubusercontent.com/u/2569867?v=4","gravatar_id":"","url":"https://api.github.com/users/dustinvtran","html_url":"https://github.com/dustinvtran","followers_url":"https://api.github.com/users/dustinvtran/followers","following_url":"https://api.github.com/users/dustinvtran/following{/other_user}","gists_url":"https://api.github.com/users/dustinvtran/gists{/gist_id}","starred_url":"https://api.github.com/users/dustinvtran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dustinvtran/subscriptions","organizations_url":"https://api.github.com/users/dustinvtran/orgs","repos_url":"https://api.github.com/users/dustinvtran/repos","events_url":"https://api.github.com/users/dustinvtran/events{/privacy}","received_events_url":"https://api.github.com/users/dustinvtran/received_events","type":"User","site_admin":false},"body":"This fails if `inverse_temperatures` is already a Tensor. Maybe cast?","created_at":"2018-03-15T07:08:48Z","updated_at":"2018-03-15T07:10:24Z","html_url":"https://github.com/blei-lab/edward/pull/871#discussion_r174692433","pull_request_url":"https://api.github.com/repos/blei-lab/edward/pulls/871","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/comments/174692433"},"html":{"href":"https://github.com/blei-lab/edward/pull/871#discussion_r174692433"},"pull_request":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/871"}}},"pull_request":{"url":"https://api.github.com/repos/blei-lab/edward/pulls/871","id":175153561,"html_url":"https://github.com/blei-lab/edward/pull/871","diff_url":"https://github.com/blei-lab/edward/pull/871.diff","patch_url":"https://github.com/blei-lab/edward/pull/871.patch","issue_url":"https://api.github.com/repos/blei-lab/edward/issues/871","number":871,"state":"open","locked":false,"title":"Fix errors in ReplicaExchangeMC","user":{"login":"YoshikawaMasashi","id":17809477,"avatar_url":"https://avatars0.githubusercontent.com/u/17809477?v=4","gravatar_id":"","url":"https://api.github.com/users/YoshikawaMasashi","html_url":"https://github.com/YoshikawaMasashi","followers_url":"https://api.github.com/users/YoshikawaMasashi/followers","following_url":"https://api.github.com/users/YoshikawaMasashi/following{/other_user}","gists_url":"https://api.github.com/users/YoshikawaMasashi/gists{/gist_id}","starred_url":"https://api.github.com/users/YoshikawaMasashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YoshikawaMasashi/subscriptions","organizations_url":"https://api.github.com/users/YoshikawaMasashi/orgs","repos_url":"https://api.github.com/users/YoshikawaMasashi/repos","events_url":"https://api.github.com/users/YoshikawaMasashi/events{/privacy}","received_events_url":"https://api.github.com/users/YoshikawaMasashi/received_events","type":"User","site_admin":false},"body":"Hi.\r\n\r\nI implemented ReplicaExchangeMC in #865. But I found some errors and fixed.\r\n\r\n<h3>multiple latent variables</h3>\r\n\r\nA code which use multiple latent variables does not work, and this code does not work.\r\n```python\r\ninference = ed.ReplicaExchangeMC({w: q_w, b: q_b}, {w: proposal_w, b:proposal_b},\r\n                                                              data={X: X_train, y: y_train})\r\ninference.run()\r\n```\r\nThe cause for this is that callable which return a dict cannot be used in `tf.case`.\r\nThe error occurs in this code. In this code `replica_sample[i]` is dict. (Exceptionally, It seem that a dict which has only one variable does work.)\r\n```python\r\nsample_i = tf.case({tf.equal(new_replica_idx[candi], i): _stateful_lambda(\r\n                    replica_sample[i])for i in range(self.n_replica)},\r\n                   default=lambda: replica_sample[0], exclusive=True)\r\n```\r\nTherefore, I fixed this error. I implemented to calculate rates at each replica first. And `tf.case` is not used.\r\n\r\n<h3>list for `latent_vars`</h3>\r\n\r\nWhen I use a list for `latent_vars`, an error occurs.\r\n```Python\r\ninference = ed.ReplicaExchangeMC(latent_vars=[x],\r\n                             proposal_vars={x: proposal_x})\r\ninference.run()\r\n```\r\nIn `super(ReplicaExchangeMC, self).__init__(latent_vars, data)`, `latent_vars`(list) is converted to `latent_vars`(dict). But before this, `latent_vars`(dict) is needed. I also fixed this.\r\n\r\nThanks","created_at":"2018-03-15T05:41:32Z","updated_at":"2018-03-15T07:10:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"767b1b72be7f89938c62fe793c8506e22e0de640","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/blei-lab/edward/pulls/871/commits","review_comments_url":"https://api.github.com/repos/blei-lab/edward/pulls/871/comments","review_comment_url":"https://api.github.com/repos/blei-lab/edward/pulls/comments{/number}","comments_url":"https://api.github.com/repos/blei-lab/edward/issues/871/comments","statuses_url":"https://api.github.com/repos/blei-lab/edward/statuses/c06f005f115c233f9b48b9de4621136d2c7d982a","head":{"label":"YoshikawaMasashi:Fix/ReplicaExchangeMC","ref":"Fix/ReplicaExchangeMC","sha":"c06f005f115c233f9b48b9de4621136d2c7d982a","user":{"login":"YoshikawaMasashi","id":17809477,"avatar_url":"https://avatars0.githubusercontent.com/u/17809477?v=4","gravatar_id":"","url":"https://api.github.com/users/YoshikawaMasashi","html_url":"https://github.com/YoshikawaMasashi","followers_url":"https://api.github.com/users/YoshikawaMasashi/followers","following_url":"https://api.github.com/users/YoshikawaMasashi/following{/other_user}","gists_url":"https://api.github.com/users/YoshikawaMasashi/gists{/gist_id}","starred_url":"https://api.github.com/users/YoshikawaMasashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YoshikawaMasashi/subscriptions","organizations_url":"https://api.github.com/users/YoshikawaMasashi/orgs","repos_url":"https://api.github.com/users/YoshikawaMasashi/repos","events_url":"https://api.github.com/users/YoshikawaMasashi/events{/privacy}","received_events_url":"https://api.github.com/users/YoshikawaMasashi/received_events","type":"User","site_admin":false},"repo":{"id":124164256,"name":"edward","full_name":"YoshikawaMasashi/edward","owner":{"login":"YoshikawaMasashi","id":17809477,"avatar_url":"https://avatars0.githubusercontent.com/u/17809477?v=4","gravatar_id":"","url":"https://api.github.com/users/YoshikawaMasashi","html_url":"https://github.com/YoshikawaMasashi","followers_url":"https://api.github.com/users/YoshikawaMasashi/followers","following_url":"https://api.github.com/users/YoshikawaMasashi/following{/other_user}","gists_url":"https://api.github.com/users/YoshikawaMasashi/gists{/gist_id}","starred_url":"https://api.github.com/users/YoshikawaMasashi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YoshikawaMasashi/subscriptions","organizations_url":"https://api.github.com/users/YoshikawaMasashi/orgs","repos_url":"https://api.github.com/users/YoshikawaMasashi/repos","events_url":"https://api.github.com/users/YoshikawaMasashi/events{/privacy}","received_events_url":"https://api.github.com/users/YoshikawaMasashi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/YoshikawaMasashi/edward","description":"A probabilistic programming language in TensorFlow. Deep generative models, variational inference.","fork":true,"url":"https://api.github.com/repos/YoshikawaMasashi/edward","forks_url":"https://api.github.com/repos/YoshikawaMasashi/edward/forks","keys_url":"https://api.github.com/repos/YoshikawaMasashi/edward/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YoshikawaMasashi/edward/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YoshikawaMasashi/edward/teams","hooks_url":"https://api.github.com/repos/YoshikawaMasashi/edward/hooks","issue_events_url":"https://api.github.com/repos/YoshikawaMasashi/edward/issues/events{/number}","events_url":"https://api.github.com/repos/YoshikawaMasashi/edward/events","assignees_url":"https://api.github.com/repos/YoshikawaMasashi/edward/assignees{/user}","branches_url":"https://api.github.com/repos/YoshikawaMasashi/edward/branches{/branch}","tags_url":"https://api.github.com/repos/YoshikawaMasashi/edward/tags","blobs_url":"https://api.github.com/repos/YoshikawaMasashi/edward/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YoshikawaMasashi/edward/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YoshikawaMasashi/edward/git/refs{/sha}","trees_url":"https://api.github.com/repos/YoshikawaMasashi/edward/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YoshikawaMasashi/edward/statuses/{sha}","languages_url":"https://api.github.com/repos/YoshikawaMasashi/edward/languages","stargazers_url":"https://api.github.com/repos/YoshikawaMasashi/edward/stargazers","contributors_url":"https://api.github.com/repos/YoshikawaMasashi/edward/contributors","subscribers_url":"https://api.github.com/repos/YoshikawaMasashi/edward/subscribers","subscription_url":"https://api.github.com/repos/YoshikawaMasashi/edward/subscription","commits_url":"https://api.github.com/repos/YoshikawaMasashi/edward/commits{/sha}","git_commits_url":"https://api.github.com/repos/YoshikawaMasashi/edward/git/commits{/sha}","comments_url":"https://api.github.com/repos/YoshikawaMasashi/edward/comments{/number}","issue_comment_url":"https://api.github.com/repos/YoshikawaMasashi/edward/issues/comments{/number}","contents_url":"https://api.github.com/repos/YoshikawaMasashi/edward/contents/{+path}","compare_url":"https://api.github.com/repos/YoshikawaMasashi/edward/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YoshikawaMasashi/edward/merges","archive_url":"https://api.github.com/repos/YoshikawaMasashi/edward/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YoshikawaMasashi/edward/downloads","issues_url":"https://api.github.com/repos/YoshikawaMasashi/edward/issues{/number}","pulls_url":"https://api.github.com/repos/YoshikawaMasashi/edward/pulls{/number}","milestones_url":"https://api.github.com/repos/YoshikawaMasashi/edward/milestones{/number}","notifications_url":"https://api.github.com/repos/YoshikawaMasashi/edward/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YoshikawaMasashi/edward/labels{/name}","releases_url":"https://api.github.com/repos/YoshikawaMasashi/edward/releases{/id}","deployments_url":"https://api.github.com/repos/YoshikawaMasashi/edward/deployments","created_at":"2018-03-07T02:02:47Z","updated_at":"2018-03-07T02:02:50Z","pushed_at":"2018-03-15T05:32:01Z","git_url":"git://github.com/YoshikawaMasashi/edward.git","ssh_url":"git@github.com:YoshikawaMasashi/edward.git","clone_url":"https://github.com/YoshikawaMasashi/edward.git","svn_url":"https://github.com/YoshikawaMasashi/edward","homepage":"http://edwardlib.org","size":29768,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"blei-lab:master","ref":"master","sha":"62f4ad54fda3948be9e3e848bee1a9199598081e","user":{"login":"blei-lab","id":9000745,"avatar_url":"https://avatars2.githubusercontent.com/u/9000745?v=4","gravatar_id":"","url":"https://api.github.com/users/blei-lab","html_url":"https://github.com/blei-lab","followers_url":"https://api.github.com/users/blei-lab/followers","following_url":"https://api.github.com/users/blei-lab/following{/other_user}","gists_url":"https://api.github.com/users/blei-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/blei-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blei-lab/subscriptions","organizations_url":"https://api.github.com/users/blei-lab/orgs","repos_url":"https://api.github.com/users/blei-lab/repos","events_url":"https://api.github.com/users/blei-lab/events{/privacy}","received_events_url":"https://api.github.com/users/blei-lab/received_events","type":"Organization","site_admin":false},"repo":{"id":51468412,"name":"edward","full_name":"blei-lab/edward","owner":{"login":"blei-lab","id":9000745,"avatar_url":"https://avatars2.githubusercontent.com/u/9000745?v=4","gravatar_id":"","url":"https://api.github.com/users/blei-lab","html_url":"https://github.com/blei-lab","followers_url":"https://api.github.com/users/blei-lab/followers","following_url":"https://api.github.com/users/blei-lab/following{/other_user}","gists_url":"https://api.github.com/users/blei-lab/gists{/gist_id}","starred_url":"https://api.github.com/users/blei-lab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blei-lab/subscriptions","organizations_url":"https://api.github.com/users/blei-lab/orgs","repos_url":"https://api.github.com/users/blei-lab/repos","events_url":"https://api.github.com/users/blei-lab/events{/privacy}","received_events_url":"https://api.github.com/users/blei-lab/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/blei-lab/edward","description":"A probabilistic programming language in TensorFlow. Deep generative models, variational inference.","fork":false,"url":"https://api.github.com/repos/blei-lab/edward","forks_url":"https://api.github.com/repos/blei-lab/edward/forks","keys_url":"https://api.github.com/repos/blei-lab/edward/keys{/key_id}","collaborators_url":"https://api.github.com/repos/blei-lab/edward/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/blei-lab/edward/teams","hooks_url":"https://api.github.com/repos/blei-lab/edward/hooks","issue_events_url":"https://api.github.com/repos/blei-lab/edward/issues/events{/number}","events_url":"https://api.github.com/repos/blei-lab/edward/events","assignees_url":"https://api.github.com/repos/blei-lab/edward/assignees{/user}","branches_url":"https://api.github.com/repos/blei-lab/edward/branches{/branch}","tags_url":"https://api.github.com/repos/blei-lab/edward/tags","blobs_url":"https://api.github.com/repos/blei-lab/edward/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/blei-lab/edward/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/blei-lab/edward/git/refs{/sha}","trees_url":"https://api.github.com/repos/blei-lab/edward/git/trees{/sha}","statuses_url":"https://api.github.com/repos/blei-lab/edward/statuses/{sha}","languages_url":"https://api.github.com/repos/blei-lab/edward/languages","stargazers_url":"https://api.github.com/repos/blei-lab/edward/stargazers","contributors_url":"https://api.github.com/repos/blei-lab/edward/contributors","subscribers_url":"https://api.github.com/repos/blei-lab/edward/subscribers","subscription_url":"https://api.github.com/repos/blei-lab/edward/subscription","commits_url":"https://api.github.com/repos/blei-lab/edward/commits{/sha}","git_commits_url":"https://api.github.com/repos/blei-lab/edward/git/commits{/sha}","comments_url":"https://api.github.com/repos/blei-lab/edward/comments{/number}","issue_comment_url":"https://api.github.com/repos/blei-lab/edward/issues/comments{/number}","contents_url":"https://api.github.com/repos/blei-lab/edward/contents/{+path}","compare_url":"https://api.github.com/repos/blei-lab/edward/compare/{base}...{head}","merges_url":"https://api.github.com/repos/blei-lab/edward/merges","archive_url":"https://api.github.com/repos/blei-lab/edward/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/blei-lab/edward/downloads","issues_url":"https://api.github.com/repos/blei-lab/edward/issues{/number}","pulls_url":"https://api.github.com/repos/blei-lab/edward/pulls{/number}","milestones_url":"https://api.github.com/repos/blei-lab/edward/milestones{/number}","notifications_url":"https://api.github.com/repos/blei-lab/edward/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/blei-lab/edward/labels{/name}","releases_url":"https://api.github.com/repos/blei-lab/edward/releases{/id}","deployments_url":"https://api.github.com/repos/blei-lab/edward/deployments","created_at":"2016-02-10T20:06:05Z","updated_at":"2018-03-15T05:33:23Z","pushed_at":"2018-03-15T05:41:33Z","git_url":"git://github.com/blei-lab/edward.git","ssh_url":"git@github.com:blei-lab/edward.git","clone_url":"https://github.com/blei-lab/edward.git","svn_url":"https://github.com/blei-lab/edward","homepage":"http://edwardlib.org","size":29695,"stargazers_count":3384,"watchers_count":3384,"language":"Jupyter Notebook","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":595,"mirror_url":null,"archived":false,"open_issues_count":155,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":595,"open_issues":155,"watchers":3384,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/871"},"html":{"href":"https://github.com/blei-lab/edward/pull/871"},"issue":{"href":"https://api.github.com/repos/blei-lab/edward/issues/871"},"comments":{"href":"https://api.github.com/repos/blei-lab/edward/issues/871/comments"},"review_comments":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/871/comments"},"review_comment":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/blei-lab/edward/pulls/871/commits"},"statuses":{"href":"https://api.github.com/repos/blei-lab/edward/statuses/c06f005f115c233f9b48b9de4621136d2c7d982a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dustinvtran"}}