{"action":"created","comment":{"url":"https://api.github.com/repos/rlworkgroup/garage/pulls/comments/207627629","pull_request_review_id":143280441,"id":207627629,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNzYyNzYyOQ==","diff_hunk":"@@ -1,68 +1,54 @@\n-from cached_property import cached_property\n from gym.spaces import Box as GymBox\n from gym.spaces import Discrete as GymDiscrete\n from gym.spaces import Tuple as GymTuple\n \n-from garage.envs import EnvSpec\n-from garage.envs import ProxyEnv\n+from garage.envs import GarageEnv\n from garage.tf.spaces import Box\n from garage.tf.spaces import Discrete\n from garage.tf.spaces import Product\n \n \n-def to_tf_space(space):\n-    if isinstance(space, GymBox):\n-        return Box(low=space.low, high=space.high)\n-    elif isinstance(space, GymDiscrete):\n-        return Discrete(space.n)\n-    elif isinstance(space, GymTuple):\n-        return Product(list(map(to_tf_space, space.spaces)))\n-    else:\n-        raise NotImplementedError\n+class TfEnv(GarageEnv):\n+    \"\"\"\n+    Returns a TensorFlow wrapper class for gym.Env.\n \n+    Args:\n+        env (gym.Env): the env that will be wrapped\n+    \"\"\"\n \n-class WrappedCls(object):\n-    def __init__(self, cls, env_cls, extra_kwargs):\n-        self.cls = cls\n-        self.env_cls = env_cls\n-        self.extra_kwargs = extra_kwargs\n-\n-    def __call__(self, *args, **kwargs):\n-        return self.cls(\n-            self.env_cls(*args, **dict(self.extra_kwargs, **kwargs)))\n-\n-\n-class TfEnv(ProxyEnv):\n-    @cached_property\n-    def observation_space(self):\n-        return to_tf_space(self.wrapped_env.observation_space)\n+    def __init__(self, env):\n+        super().__init__(env)\n+        self.action_space = self._to_garage_space(env.action_space)\n+        self.observation_space = self._to_garage_space(env.observation_space)\n \n-    @cached_property\n-    def action_space(self):\n-        return to_tf_space(self.wrapped_env.action_space)\n-\n-    @cached_property\n-    def spec(self):\n-        return EnvSpec(\n-            observation_space=self.observation_space,\n-            action_space=self.action_space,\n-        )\n-\n-    @property\n-    def vectorized(self):\n-        return getattr(self.wrapped_env, \"vectorized\", False)\n+    def reset(self, **kwargs):\n+        return self.env.reset(**kwargs)\n \n-    def vec_env_executor(self, n_envs, max_path_length):\n-        return VecTfEnv(\n-            self.wrapped_env.vec_env_executor(\n-                n_envs=n_envs, max_path_length=max_path_length))\n+    def step(self, action):","path":"garage/tf/envs/base.py","position":72,"original_position":72,"commit_id":"a87944777227f304ace4c42bc5d2bb6ee37ee3a2","original_commit_id":"a87944777227f304ace4c42bc5d2bb6ee37ee3a2","user":{"login":"ryanjulian","id":1376219,"node_id":"MDQ6VXNlcjEzNzYyMTk=","avatar_url":"https://avatars3.githubusercontent.com/u/1376219?v=4","gravatar_id":"","url":"https://api.github.com/users/ryanjulian","html_url":"https://github.com/ryanjulian","followers_url":"https://api.github.com/users/ryanjulian/followers","following_url":"https://api.github.com/users/ryanjulian/following{/other_user}","gists_url":"https://api.github.com/users/ryanjulian/gists{/gist_id}","starred_url":"https://api.github.com/users/ryanjulian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryanjulian/subscriptions","organizations_url":"https://api.github.com/users/ryanjulian/orgs","repos_url":"https://api.github.com/users/ryanjulian/repos","events_url":"https://api.github.com/users/ryanjulian/events{/privacy}","received_events_url":"https://api.github.com/users/ryanjulian/received_events","type":"User","site_admin":false},"body":"Implemented by the superclass","created_at":"2018-08-03T18:19:08Z","updated_at":"2018-08-03T18:46:16Z","html_url":"https://github.com/rlworkgroup/garage/pull/240#discussion_r207627629","pull_request_url":"https://api.github.com/repos/rlworkgroup/garage/pulls/240","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/comments/207627629"},"html":{"href":"https://github.com/rlworkgroup/garage/pull/240#discussion_r207627629"},"pull_request":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/240"}}},"pull_request":{"url":"https://api.github.com/repos/rlworkgroup/garage/pulls/240","id":204675559,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0Njc1NTU5","html_url":"https://github.com/rlworkgroup/garage/pull/240","diff_url":"https://github.com/rlworkgroup/garage/pull/240.diff","patch_url":"https://github.com/rlworkgroup/garage/pull/240.patch","issue_url":"https://api.github.com/repos/rlworkgroup/garage/issues/240","number":240,"state":"open","locked":false,"title":"Add pickled mode support to GarageEnv/TfEnv/TheanoEnv","user":{"login":"jonashen","id":16643485,"node_id":"MDQ6VXNlcjE2NjQzNDg1","avatar_url":"https://avatars2.githubusercontent.com/u/16643485?v=4","gravatar_id":"","url":"https://api.github.com/users/jonashen","html_url":"https://github.com/jonashen","followers_url":"https://api.github.com/users/jonashen/followers","following_url":"https://api.github.com/users/jonashen/following{/other_user}","gists_url":"https://api.github.com/users/jonashen/gists{/gist_id}","starred_url":"https://api.github.com/users/jonashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonashen/subscriptions","organizations_url":"https://api.github.com/users/jonashen/orgs","repos_url":"https://api.github.com/users/jonashen/repos","events_url":"https://api.github.com/users/jonashen/events{/privacy}","received_events_url":"https://api.github.com/users/jonashen/received_events","type":"User","site_admin":false},"body":"This PR refactors TfEnv and TheanoEnv to inherit from a base GarageEnv (that inherits from gym.Wrapper) which supports Parameterization and Serialization. Assert statements are also added whenever envs are passed into functions as a safety check.\r\n\r\nIn short, gym environments are now expected to be wrapped within TfEnv() or TheanoEnv() to convert to a local garage environment to ensure compatibility with garage functions and policies.\r\n\r\nRef: #231 ","created_at":"2018-07-30T01:48:19Z","updated_at":"2018-08-03T18:46:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f4aae46c680ea26a13f81fb12f5bbe167980f112","assignee":{"login":"jonashen","id":16643485,"node_id":"MDQ6VXNlcjE2NjQzNDg1","avatar_url":"https://avatars2.githubusercontent.com/u/16643485?v=4","gravatar_id":"","url":"https://api.github.com/users/jonashen","html_url":"https://github.com/jonashen","followers_url":"https://api.github.com/users/jonashen/followers","following_url":"https://api.github.com/users/jonashen/following{/other_user}","gists_url":"https://api.github.com/users/jonashen/gists{/gist_id}","starred_url":"https://api.github.com/users/jonashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonashen/subscriptions","organizations_url":"https://api.github.com/users/jonashen/orgs","repos_url":"https://api.github.com/users/jonashen/repos","events_url":"https://api.github.com/users/jonashen/events{/privacy}","received_events_url":"https://api.github.com/users/jonashen/received_events","type":"User","site_admin":false},"assignees":[{"login":"jonashen","id":16643485,"node_id":"MDQ6VXNlcjE2NjQzNDg1","avatar_url":"https://avatars2.githubusercontent.com/u/16643485?v=4","gravatar_id":"","url":"https://api.github.com/users/jonashen","html_url":"https://github.com/jonashen","followers_url":"https://api.github.com/users/jonashen/followers","following_url":"https://api.github.com/users/jonashen/following{/other_user}","gists_url":"https://api.github.com/users/jonashen/gists{/gist_id}","starred_url":"https://api.github.com/users/jonashen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonashen/subscriptions","organizations_url":"https://api.github.com/users/jonashen/orgs","repos_url":"https://api.github.com/users/jonashen/repos","events_url":"https://api.github.com/users/jonashen/events{/privacy}","received_events_url":"https://api.github.com/users/jonashen/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rlworkgroup/garage/pulls/240/commits","review_comments_url":"https://api.github.com/repos/rlworkgroup/garage/pulls/240/comments","review_comment_url":"https://api.github.com/repos/rlworkgroup/garage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rlworkgroup/garage/issues/240/comments","statuses_url":"https://api.github.com/repos/rlworkgroup/garage/statuses/a87944777227f304ace4c42bc5d2bb6ee37ee3a2","head":{"label":"rlworkgroup:pickled_env","ref":"pickled_env","sha":"a87944777227f304ace4c42bc5d2bb6ee37ee3a2","user":{"login":"rlworkgroup","id":39808070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5ODA4MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/39808070?v=4","gravatar_id":"","url":"https://api.github.com/users/rlworkgroup","html_url":"https://github.com/rlworkgroup","followers_url":"https://api.github.com/users/rlworkgroup/followers","following_url":"https://api.github.com/users/rlworkgroup/following{/other_user}","gists_url":"https://api.github.com/users/rlworkgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rlworkgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlworkgroup/subscriptions","organizations_url":"https://api.github.com/users/rlworkgroup/orgs","repos_url":"https://api.github.com/users/rlworkgroup/repos","events_url":"https://api.github.com/users/rlworkgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rlworkgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":136846372,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY4NDYzNzI=","name":"garage","full_name":"rlworkgroup/garage","owner":{"login":"rlworkgroup","id":39808070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5ODA4MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/39808070?v=4","gravatar_id":"","url":"https://api.github.com/users/rlworkgroup","html_url":"https://github.com/rlworkgroup","followers_url":"https://api.github.com/users/rlworkgroup/followers","following_url":"https://api.github.com/users/rlworkgroup/following{/other_user}","gists_url":"https://api.github.com/users/rlworkgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rlworkgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlworkgroup/subscriptions","organizations_url":"https://api.github.com/users/rlworkgroup/orgs","repos_url":"https://api.github.com/users/rlworkgroup/repos","events_url":"https://api.github.com/users/rlworkgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rlworkgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rlworkgroup/garage","description":"Everything you need to develop and test deep reinforcement learning algorithms","fork":false,"url":"https://api.github.com/repos/rlworkgroup/garage","forks_url":"https://api.github.com/repos/rlworkgroup/garage/forks","keys_url":"https://api.github.com/repos/rlworkgroup/garage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rlworkgroup/garage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rlworkgroup/garage/teams","hooks_url":"https://api.github.com/repos/rlworkgroup/garage/hooks","issue_events_url":"https://api.github.com/repos/rlworkgroup/garage/issues/events{/number}","events_url":"https://api.github.com/repos/rlworkgroup/garage/events","assignees_url":"https://api.github.com/repos/rlworkgroup/garage/assignees{/user}","branches_url":"https://api.github.com/repos/rlworkgroup/garage/branches{/branch}","tags_url":"https://api.github.com/repos/rlworkgroup/garage/tags","blobs_url":"https://api.github.com/repos/rlworkgroup/garage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rlworkgroup/garage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rlworkgroup/garage/git/refs{/sha}","trees_url":"https://api.github.com/repos/rlworkgroup/garage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rlworkgroup/garage/statuses/{sha}","languages_url":"https://api.github.com/repos/rlworkgroup/garage/languages","stargazers_url":"https://api.github.com/repos/rlworkgroup/garage/stargazers","contributors_url":"https://api.github.com/repos/rlworkgroup/garage/contributors","subscribers_url":"https://api.github.com/repos/rlworkgroup/garage/subscribers","subscription_url":"https://api.github.com/repos/rlworkgroup/garage/subscription","commits_url":"https://api.github.com/repos/rlworkgroup/garage/commits{/sha}","git_commits_url":"https://api.github.com/repos/rlworkgroup/garage/git/commits{/sha}","comments_url":"https://api.github.com/repos/rlworkgroup/garage/comments{/number}","issue_comment_url":"https://api.github.com/repos/rlworkgroup/garage/issues/comments{/number}","contents_url":"https://api.github.com/repos/rlworkgroup/garage/contents/{+path}","compare_url":"https://api.github.com/repos/rlworkgroup/garage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rlworkgroup/garage/merges","archive_url":"https://api.github.com/repos/rlworkgroup/garage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rlworkgroup/garage/downloads","issues_url":"https://api.github.com/repos/rlworkgroup/garage/issues{/number}","pulls_url":"https://api.github.com/repos/rlworkgroup/garage/pulls{/number}","milestones_url":"https://api.github.com/repos/rlworkgroup/garage/milestones{/number}","notifications_url":"https://api.github.com/repos/rlworkgroup/garage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rlworkgroup/garage/labels{/name}","releases_url":"https://api.github.com/repos/rlworkgroup/garage/releases{/id}","deployments_url":"https://api.github.com/repos/rlworkgroup/garage/deployments","created_at":"2018-06-10T21:31:23Z","updated_at":"2018-08-03T01:56:22Z","pushed_at":"2018-08-03T18:20:00Z","git_url":"git://github.com/rlworkgroup/garage.git","ssh_url":"git@github.com:rlworkgroup/garage.git","clone_url":"https://github.com/rlworkgroup/garage.git","svn_url":"https://github.com/rlworkgroup/garage","homepage":"","size":7783,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":81,"watchers":9,"default_branch":"master"}},"base":{"label":"rlworkgroup:master","ref":"master","sha":"eff8fbd2e3fb295d3c42dbc28d9d7cbcb6ca64ad","user":{"login":"rlworkgroup","id":39808070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5ODA4MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/39808070?v=4","gravatar_id":"","url":"https://api.github.com/users/rlworkgroup","html_url":"https://github.com/rlworkgroup","followers_url":"https://api.github.com/users/rlworkgroup/followers","following_url":"https://api.github.com/users/rlworkgroup/following{/other_user}","gists_url":"https://api.github.com/users/rlworkgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rlworkgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlworkgroup/subscriptions","organizations_url":"https://api.github.com/users/rlworkgroup/orgs","repos_url":"https://api.github.com/users/rlworkgroup/repos","events_url":"https://api.github.com/users/rlworkgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rlworkgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":136846372,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY4NDYzNzI=","name":"garage","full_name":"rlworkgroup/garage","owner":{"login":"rlworkgroup","id":39808070,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5ODA4MDcw","avatar_url":"https://avatars0.githubusercontent.com/u/39808070?v=4","gravatar_id":"","url":"https://api.github.com/users/rlworkgroup","html_url":"https://github.com/rlworkgroup","followers_url":"https://api.github.com/users/rlworkgroup/followers","following_url":"https://api.github.com/users/rlworkgroup/following{/other_user}","gists_url":"https://api.github.com/users/rlworkgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rlworkgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlworkgroup/subscriptions","organizations_url":"https://api.github.com/users/rlworkgroup/orgs","repos_url":"https://api.github.com/users/rlworkgroup/repos","events_url":"https://api.github.com/users/rlworkgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rlworkgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rlworkgroup/garage","description":"Everything you need to develop and test deep reinforcement learning algorithms","fork":false,"url":"https://api.github.com/repos/rlworkgroup/garage","forks_url":"https://api.github.com/repos/rlworkgroup/garage/forks","keys_url":"https://api.github.com/repos/rlworkgroup/garage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rlworkgroup/garage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rlworkgroup/garage/teams","hooks_url":"https://api.github.com/repos/rlworkgroup/garage/hooks","issue_events_url":"https://api.github.com/repos/rlworkgroup/garage/issues/events{/number}","events_url":"https://api.github.com/repos/rlworkgroup/garage/events","assignees_url":"https://api.github.com/repos/rlworkgroup/garage/assignees{/user}","branches_url":"https://api.github.com/repos/rlworkgroup/garage/branches{/branch}","tags_url":"https://api.github.com/repos/rlworkgroup/garage/tags","blobs_url":"https://api.github.com/repos/rlworkgroup/garage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rlworkgroup/garage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rlworkgroup/garage/git/refs{/sha}","trees_url":"https://api.github.com/repos/rlworkgroup/garage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rlworkgroup/garage/statuses/{sha}","languages_url":"https://api.github.com/repos/rlworkgroup/garage/languages","stargazers_url":"https://api.github.com/repos/rlworkgroup/garage/stargazers","contributors_url":"https://api.github.com/repos/rlworkgroup/garage/contributors","subscribers_url":"https://api.github.com/repos/rlworkgroup/garage/subscribers","subscription_url":"https://api.github.com/repos/rlworkgroup/garage/subscription","commits_url":"https://api.github.com/repos/rlworkgroup/garage/commits{/sha}","git_commits_url":"https://api.github.com/repos/rlworkgroup/garage/git/commits{/sha}","comments_url":"https://api.github.com/repos/rlworkgroup/garage/comments{/number}","issue_comment_url":"https://api.github.com/repos/rlworkgroup/garage/issues/comments{/number}","contents_url":"https://api.github.com/repos/rlworkgroup/garage/contents/{+path}","compare_url":"https://api.github.com/repos/rlworkgroup/garage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rlworkgroup/garage/merges","archive_url":"https://api.github.com/repos/rlworkgroup/garage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rlworkgroup/garage/downloads","issues_url":"https://api.github.com/repos/rlworkgroup/garage/issues{/number}","pulls_url":"https://api.github.com/repos/rlworkgroup/garage/pulls{/number}","milestones_url":"https://api.github.com/repos/rlworkgroup/garage/milestones{/number}","notifications_url":"https://api.github.com/repos/rlworkgroup/garage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rlworkgroup/garage/labels{/name}","releases_url":"https://api.github.com/repos/rlworkgroup/garage/releases{/id}","deployments_url":"https://api.github.com/repos/rlworkgroup/garage/deployments","created_at":"2018-06-10T21:31:23Z","updated_at":"2018-08-03T01:56:22Z","pushed_at":"2018-08-03T18:20:00Z","git_url":"git://github.com/rlworkgroup/garage.git","ssh_url":"git@github.com:rlworkgroup/garage.git","clone_url":"https://github.com/rlworkgroup/garage.git","svn_url":"https://github.com/rlworkgroup/garage","homepage":"","size":7783,"stargazers_count":9,"watchers_count":9,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":81,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/240"},"html":{"href":"https://github.com/rlworkgroup/garage/pull/240"},"issue":{"href":"https://api.github.com/repos/rlworkgroup/garage/issues/240"},"comments":{"href":"https://api.github.com/repos/rlworkgroup/garage/issues/240/comments"},"review_comments":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/240/comments"},"review_comment":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rlworkgroup/garage/pulls/240/commits"},"statuses":{"href":"https://api.github.com/repos/rlworkgroup/garage/statuses/a87944777227f304ace4c42bc5d2bb6ee37ee3a2"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ryanjulian"}}