{"action":"created","comment":{"url":"https://api.github.com/repos/dmlc/minpy/pulls/comments/77936194","id":77936194,"diff_hunk":"@@ -5,47 +5,57 @@\n from __future__ import absolute_import\n from __future__ import print_function\n \n-import mxnet as mx\n import functools\n \n-from minpy.array import Value\n-from minpy.array_variants import ArrayType, array_types, number_types\n-from minpy.context import current_context\n-from minpy.primitive import Primitive\n-from minpy.utils import log\n+from .array import Value\n+from .array_variants import ArrayType, array_types, number_types\n+from .context import current_context\n+from .primitive import Primitive\n+from .utils import log\n+from . import tape\n \n _logger = log.get_logger(__name__)\n \n+\n def grad_and_loss(func, argnum=0, method=False):\n     \"\"\"Return function that computes both gradient and loss value.\n \n-    :param func: The forward (loss) function.\n-    :param argnum: The index of argument to calculate gradient for.\n-    :param method: Skip the first argument 'self' if func is a method.\n-    :return: A function that would compute both the gradient of the specified argument and loss value.\n+    Parameters\n+    ----------\n+    func\n+        The forward (loss) function.\n+    argnum\n+        The index of argument to calculate gradient for.\n+    method\n+        Skip the first argument 'self' if func is a method.\n+\n+    Returns\n+    -------\n+    function\n+        A function that would compute both the gradient of the specified argument and loss value.\n     \"\"\"\n-    # pylint: disable= missing-docstring\n+\n     @functools.wraps(func)\n     def wrapped(*args):\n+        \"\"\"Wrapped function.\"\"\"\n         if method:\n             args = args[1:]\n         arrays = tuple(Value.wrap(a) for a in args)\n         argnums = [argnum] if isinstance(argnum, int) else argnum\n         for i in argnums:\n             arrays[i]._marked_for_bp = True","path":"minpy/core.py","position":53,"original_position":53,"commit_id":"e5599d3acc429e121353c650adc7c83a76b87dab","original_commit_id":"e5599d3acc429e121353c650adc7c83a76b87dab","user":{"login":"hotpxl","id":2174815,"avatar_url":"https://avatars.githubusercontent.com/u/2174815?v=3","gravatar_id":"","url":"https://api.github.com/users/hotpxl","html_url":"https://github.com/hotpxl","followers_url":"https://api.github.com/users/hotpxl/followers","following_url":"https://api.github.com/users/hotpxl/following{/other_user}","gists_url":"https://api.github.com/users/hotpxl/gists{/gist_id}","starred_url":"https://api.github.com/users/hotpxl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotpxl/subscriptions","organizations_url":"https://api.github.com/users/hotpxl/orgs","repos_url":"https://api.github.com/users/hotpxl/repos","events_url":"https://api.github.com/users/hotpxl/events{/privacy}","received_events_url":"https://api.github.com/users/hotpxl/received_events","type":"User","site_admin":false},"body":"Still needed to calculate `need_bp`","created_at":"2016-09-08T02:06:18Z","updated_at":"2016-09-08T02:06:18Z","html_url":"https://github.com/dmlc/minpy/pull/40#discussion_r77936194","pull_request_url":"https://api.github.com/repos/dmlc/minpy/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/comments/77936194"},"html":{"href":"https://github.com/dmlc/minpy/pull/40#discussion_r77936194"},"pull_request":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/dmlc/minpy/pulls/40","id":84336125,"html_url":"https://github.com/dmlc/minpy/pull/40","diff_url":"https://github.com/dmlc/minpy/pull/40.diff","patch_url":"https://github.com/dmlc/minpy/pull/40.patch","issue_url":"https://api.github.com/repos/dmlc/minpy/issues/40","number":40,"state":"open","locked":false,"title":"Multi target grad","user":{"login":"hotpxl","id":2174815,"avatar_url":"https://avatars.githubusercontent.com/u/2174815?v=3","gravatar_id":"","url":"https://api.github.com/users/hotpxl","html_url":"https://github.com/hotpxl","followers_url":"https://api.github.com/users/hotpxl/followers","following_url":"https://api.github.com/users/hotpxl/following{/other_user}","gists_url":"https://api.github.com/users/hotpxl/gists{/gist_id}","starred_url":"https://api.github.com/users/hotpxl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotpxl/subscriptions","organizations_url":"https://api.github.com/users/hotpxl/orgs","repos_url":"https://api.github.com/users/hotpxl/repos","events_url":"https://api.github.com/users/hotpxl/events{/privacy}","received_events_url":"https://api.github.com/users/hotpxl/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-07T16:49:14Z","updated_at":"2016-09-08T02:06:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe5e6222ffc55fb507e22cb819e70094675691b0","assignee":{"login":"hotpxl","id":2174815,"avatar_url":"https://avatars.githubusercontent.com/u/2174815?v=3","gravatar_id":"","url":"https://api.github.com/users/hotpxl","html_url":"https://github.com/hotpxl","followers_url":"https://api.github.com/users/hotpxl/followers","following_url":"https://api.github.com/users/hotpxl/following{/other_user}","gists_url":"https://api.github.com/users/hotpxl/gists{/gist_id}","starred_url":"https://api.github.com/users/hotpxl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotpxl/subscriptions","organizations_url":"https://api.github.com/users/hotpxl/orgs","repos_url":"https://api.github.com/users/hotpxl/repos","events_url":"https://api.github.com/users/hotpxl/events{/privacy}","received_events_url":"https://api.github.com/users/hotpxl/received_events","type":"User","site_admin":false},"assignees":[{"login":"hotpxl","id":2174815,"avatar_url":"https://avatars.githubusercontent.com/u/2174815?v=3","gravatar_id":"","url":"https://api.github.com/users/hotpxl","html_url":"https://github.com/hotpxl","followers_url":"https://api.github.com/users/hotpxl/followers","following_url":"https://api.github.com/users/hotpxl/following{/other_user}","gists_url":"https://api.github.com/users/hotpxl/gists{/gist_id}","starred_url":"https://api.github.com/users/hotpxl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotpxl/subscriptions","organizations_url":"https://api.github.com/users/hotpxl/orgs","repos_url":"https://api.github.com/users/hotpxl/repos","events_url":"https://api.github.com/users/hotpxl/events{/privacy}","received_events_url":"https://api.github.com/users/hotpxl/received_events","type":"User","site_admin":false},{"login":"jermainewang","id":4057701,"avatar_url":"https://avatars.githubusercontent.com/u/4057701?v=3","gravatar_id":"","url":"https://api.github.com/users/jermainewang","html_url":"https://github.com/jermainewang","followers_url":"https://api.github.com/users/jermainewang/followers","following_url":"https://api.github.com/users/jermainewang/following{/other_user}","gists_url":"https://api.github.com/users/jermainewang/gists{/gist_id}","starred_url":"https://api.github.com/users/jermainewang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jermainewang/subscriptions","organizations_url":"https://api.github.com/users/jermainewang/orgs","repos_url":"https://api.github.com/users/jermainewang/repos","events_url":"https://api.github.com/users/jermainewang/events{/privacy}","received_events_url":"https://api.github.com/users/jermainewang/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/dmlc/minpy/milestones/1","html_url":"https://github.com/dmlc/minpy/milestones/Version%200.2","labels_url":"https://api.github.com/repos/dmlc/minpy/milestones/1/labels","id":1946931,"number":1,"title":"Version 0.2","description":null,"creator":{"login":"jermainewang","id":4057701,"avatar_url":"https://avatars.githubusercontent.com/u/4057701?v=3","gravatar_id":"","url":"https://api.github.com/users/jermainewang","html_url":"https://github.com/jermainewang","followers_url":"https://api.github.com/users/jermainewang/followers","following_url":"https://api.github.com/users/jermainewang/following{/other_user}","gists_url":"https://api.github.com/users/jermainewang/gists{/gist_id}","starred_url":"https://api.github.com/users/jermainewang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jermainewang/subscriptions","organizations_url":"https://api.github.com/users/jermainewang/orgs","repos_url":"https://api.github.com/users/jermainewang/repos","events_url":"https://api.github.com/users/jermainewang/events{/privacy}","received_events_url":"https://api.github.com/users/jermainewang/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2016-08-17T08:56:23Z","updated_at":"2016-09-08T01:47:59Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/dmlc/minpy/pulls/40/commits","review_comments_url":"https://api.github.com/repos/dmlc/minpy/pulls/40/comments","review_comment_url":"https://api.github.com/repos/dmlc/minpy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmlc/minpy/issues/40/comments","statuses_url":"https://api.github.com/repos/dmlc/minpy/statuses/e5599d3acc429e121353c650adc7c83a76b87dab","head":{"label":"dmlc:multi-target-grad","ref":"multi-target-grad","sha":"e5599d3acc429e121353c650adc7c83a76b87dab","user":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"repo":{"id":45584086,"name":"minpy","full_name":"dmlc/minpy","owner":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmlc/minpy","description":"Pure NumPy practice with third-party operator integration","fork":false,"url":"https://api.github.com/repos/dmlc/minpy","forks_url":"https://api.github.com/repos/dmlc/minpy/forks","keys_url":"https://api.github.com/repos/dmlc/minpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmlc/minpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmlc/minpy/teams","hooks_url":"https://api.github.com/repos/dmlc/minpy/hooks","issue_events_url":"https://api.github.com/repos/dmlc/minpy/issues/events{/number}","events_url":"https://api.github.com/repos/dmlc/minpy/events","assignees_url":"https://api.github.com/repos/dmlc/minpy/assignees{/user}","branches_url":"https://api.github.com/repos/dmlc/minpy/branches{/branch}","tags_url":"https://api.github.com/repos/dmlc/minpy/tags","blobs_url":"https://api.github.com/repos/dmlc/minpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmlc/minpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmlc/minpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmlc/minpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmlc/minpy/statuses/{sha}","languages_url":"https://api.github.com/repos/dmlc/minpy/languages","stargazers_url":"https://api.github.com/repos/dmlc/minpy/stargazers","contributors_url":"https://api.github.com/repos/dmlc/minpy/contributors","subscribers_url":"https://api.github.com/repos/dmlc/minpy/subscribers","subscription_url":"https://api.github.com/repos/dmlc/minpy/subscription","commits_url":"https://api.github.com/repos/dmlc/minpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmlc/minpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmlc/minpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmlc/minpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmlc/minpy/contents/{+path}","compare_url":"https://api.github.com/repos/dmlc/minpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmlc/minpy/merges","archive_url":"https://api.github.com/repos/dmlc/minpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmlc/minpy/downloads","issues_url":"https://api.github.com/repos/dmlc/minpy/issues{/number}","pulls_url":"https://api.github.com/repos/dmlc/minpy/pulls{/number}","milestones_url":"https://api.github.com/repos/dmlc/minpy/milestones{/number}","notifications_url":"https://api.github.com/repos/dmlc/minpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmlc/minpy/labels{/name}","releases_url":"https://api.github.com/repos/dmlc/minpy/releases{/id}","deployments_url":"https://api.github.com/repos/dmlc/minpy/deployments","created_at":"2015-11-05T03:10:48Z","updated_at":"2016-09-06T01:53:07Z","pushed_at":"2016-09-08T01:37:01Z","git_url":"git://github.com/dmlc/minpy.git","ssh_url":"git@github.com:dmlc/minpy.git","clone_url":"https://github.com/dmlc/minpy.git","svn_url":"https://github.com/dmlc/minpy","homepage":"https://minpy.readthedocs.io/en/latest/","size":60963,"stargazers_count":163,"watchers_count":163,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":5,"forks":27,"open_issues":5,"watchers":163,"default_branch":"master"}},"base":{"label":"dmlc:master","ref":"master","sha":"b7f64157553484e3a125b7d077d67e8bbfe19483","user":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"repo":{"id":45584086,"name":"minpy","full_name":"dmlc/minpy","owner":{"login":"dmlc","id":11508361,"avatar_url":"https://avatars.githubusercontent.com/u/11508361?v=3","gravatar_id":"","url":"https://api.github.com/users/dmlc","html_url":"https://github.com/dmlc","followers_url":"https://api.github.com/users/dmlc/followers","following_url":"https://api.github.com/users/dmlc/following{/other_user}","gists_url":"https://api.github.com/users/dmlc/gists{/gist_id}","starred_url":"https://api.github.com/users/dmlc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmlc/subscriptions","organizations_url":"https://api.github.com/users/dmlc/orgs","repos_url":"https://api.github.com/users/dmlc/repos","events_url":"https://api.github.com/users/dmlc/events{/privacy}","received_events_url":"https://api.github.com/users/dmlc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dmlc/minpy","description":"Pure NumPy practice with third-party operator integration","fork":false,"url":"https://api.github.com/repos/dmlc/minpy","forks_url":"https://api.github.com/repos/dmlc/minpy/forks","keys_url":"https://api.github.com/repos/dmlc/minpy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmlc/minpy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmlc/minpy/teams","hooks_url":"https://api.github.com/repos/dmlc/minpy/hooks","issue_events_url":"https://api.github.com/repos/dmlc/minpy/issues/events{/number}","events_url":"https://api.github.com/repos/dmlc/minpy/events","assignees_url":"https://api.github.com/repos/dmlc/minpy/assignees{/user}","branches_url":"https://api.github.com/repos/dmlc/minpy/branches{/branch}","tags_url":"https://api.github.com/repos/dmlc/minpy/tags","blobs_url":"https://api.github.com/repos/dmlc/minpy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmlc/minpy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmlc/minpy/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmlc/minpy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmlc/minpy/statuses/{sha}","languages_url":"https://api.github.com/repos/dmlc/minpy/languages","stargazers_url":"https://api.github.com/repos/dmlc/minpy/stargazers","contributors_url":"https://api.github.com/repos/dmlc/minpy/contributors","subscribers_url":"https://api.github.com/repos/dmlc/minpy/subscribers","subscription_url":"https://api.github.com/repos/dmlc/minpy/subscription","commits_url":"https://api.github.com/repos/dmlc/minpy/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmlc/minpy/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmlc/minpy/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmlc/minpy/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmlc/minpy/contents/{+path}","compare_url":"https://api.github.com/repos/dmlc/minpy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmlc/minpy/merges","archive_url":"https://api.github.com/repos/dmlc/minpy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmlc/minpy/downloads","issues_url":"https://api.github.com/repos/dmlc/minpy/issues{/number}","pulls_url":"https://api.github.com/repos/dmlc/minpy/pulls{/number}","milestones_url":"https://api.github.com/repos/dmlc/minpy/milestones{/number}","notifications_url":"https://api.github.com/repos/dmlc/minpy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmlc/minpy/labels{/name}","releases_url":"https://api.github.com/repos/dmlc/minpy/releases{/id}","deployments_url":"https://api.github.com/repos/dmlc/minpy/deployments","created_at":"2015-11-05T03:10:48Z","updated_at":"2016-09-06T01:53:07Z","pushed_at":"2016-09-08T01:37:01Z","git_url":"git://github.com/dmlc/minpy.git","ssh_url":"git@github.com:dmlc/minpy.git","clone_url":"https://github.com/dmlc/minpy.git","svn_url":"https://github.com/dmlc/minpy","homepage":"https://minpy.readthedocs.io/en/latest/","size":60963,"stargazers_count":163,"watchers_count":163,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":5,"forks":27,"open_issues":5,"watchers":163,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/40"},"html":{"href":"https://github.com/dmlc/minpy/pull/40"},"issue":{"href":"https://api.github.com/repos/dmlc/minpy/issues/40"},"comments":{"href":"https://api.github.com/repos/dmlc/minpy/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmlc/minpy/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/dmlc/minpy/statuses/e5599d3acc429e121353c650adc7c83a76b87dab"}}}}
{"actor":{"display_login":"hotpxl"}}