{"action":"closed","number":1534,"pull_request":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/1534","id":82075707,"html_url":"https://github.com/pfnet/chainer/pull/1534","diff_url":"https://github.com/pfnet/chainer/pull/1534.diff","patch_url":"https://github.com/pfnet/chainer/pull/1534.patch","issue_url":"https://api.github.com/repos/pfnet/chainer/issues/1534","number":1534,"state":"closed","locked":false,"title":"Helper for testing Chainer functions lifting unary numpy/cupy functions.","user":{"login":"takagi","id":1224375,"avatar_url":"https://avatars.githubusercontent.com/u/1224375?v=3","gravatar_id":"","url":"https://api.github.com/users/takagi","html_url":"https://github.com/takagi","followers_url":"https://api.github.com/users/takagi/followers","following_url":"https://api.github.com/users/takagi/following{/other_user}","gists_url":"https://api.github.com/users/takagi/gists{/gist_id}","starred_url":"https://api.github.com/users/takagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takagi/subscriptions","organizations_url":"https://api.github.com/users/takagi/orgs","repos_url":"https://api.github.com/users/takagi/repos","events_url":"https://api.github.com/users/takagi/events{/privacy}","received_events_url":"https://api.github.com/users/takagi/received_events","type":"User","site_admin":false},"body":"Merge #1490 first.\r\n\r\nThis PR provides a mechanism to easily test Chainer functions lifted from unary numpy/cupy functions such as `exp`, `log` and `tan`. There are now duplicated test codes for that task.\r\n\r\nThis mechanism is implemented as a decorator that is applied to a test class for Chainer functions. For example, the following code is enough for testing `tan` Chainer function.\r\n\r\n```Python\r\nimport unittest\r\nfrom chainer import functions as F\r\nfrom chainer import testing\r\n\r\n@testing.unary_function_test(F.tan)\r\nclass TestTan(unittest.TestCase):\r\n    pass\r\n```\r\n\r\nWith decorated, `TestTan` class tests `tan` Chainer function for forward and backward computation on CPU and GPU, parameterized with `dtype` of FP16, FP32 and FP64, and `shape` of rank zero and more. It also tests the label of corresponding Chainer function class `F.Tan`. For detailed specification, see its docstring and the example part would help.\r\n\r\nImplementation possibilities\r\n--\r\nI've implemented the same mechanism in the following ways:\r\n\r\n- decorator meta programming\r\n- inheritance\r\n\r\nThis PR is bound to the former, achieving clearer interface but a bit more complicated implementation than the latter. [unary-funciton-test.1](https://github.com/takagi/chainer/tree/unary-function-test.1) branch implements the same thing with inheritance, which might be more Pythonic and better way, where the example above is written as:\r\n\r\n```Python\r\nfrom chainer import functions as F\r\nfrom chainer import testing\r\n\r\nclass TestTan(testing.UnaryFunctionTestBase):\r\n    def func(self):\r\n        return F.tan\r\n```\r\n\r\nWhich would be better?","created_at":"2016-08-20T10:48:07Z","updated_at":"2016-10-04T08:32:35Z","closed_at":"2016-10-04T08:32:35Z","merged_at":"2016-10-04T08:32:35Z","merge_commit_sha":"02b5bdb887929b384fc5aa87d0db7a016bdd557e","assignee":{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false},"assignees":[{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/pfnet/chainer/pulls/1534/commits","review_comments_url":"https://api.github.com/repos/pfnet/chainer/pulls/1534/comments","review_comment_url":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pfnet/chainer/issues/1534/comments","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/b0a637ab19b3a5aca9e8c759fad2213ccde33e28","head":{"label":"takagi:unary-function-test","ref":"unary-function-test","sha":"b0a637ab19b3a5aca9e8c759fad2213ccde33e28","user":{"login":"takagi","id":1224375,"avatar_url":"https://avatars.githubusercontent.com/u/1224375?v=3","gravatar_id":"","url":"https://api.github.com/users/takagi","html_url":"https://github.com/takagi","followers_url":"https://api.github.com/users/takagi/followers","following_url":"https://api.github.com/users/takagi/following{/other_user}","gists_url":"https://api.github.com/users/takagi/gists{/gist_id}","starred_url":"https://api.github.com/users/takagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takagi/subscriptions","organizations_url":"https://api.github.com/users/takagi/orgs","repos_url":"https://api.github.com/users/takagi/repos","events_url":"https://api.github.com/users/takagi/events{/privacy}","received_events_url":"https://api.github.com/users/takagi/received_events","type":"User","site_admin":false},"repo":{"id":51998665,"name":"chainer","full_name":"takagi/chainer","owner":{"login":"takagi","id":1224375,"avatar_url":"https://avatars.githubusercontent.com/u/1224375?v=3","gravatar_id":"","url":"https://api.github.com/users/takagi","html_url":"https://github.com/takagi","followers_url":"https://api.github.com/users/takagi/followers","following_url":"https://api.github.com/users/takagi/following{/other_user}","gists_url":"https://api.github.com/users/takagi/gists{/gist_id}","starred_url":"https://api.github.com/users/takagi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/takagi/subscriptions","organizations_url":"https://api.github.com/users/takagi/orgs","repos_url":"https://api.github.com/users/takagi/repos","events_url":"https://api.github.com/users/takagi/events{/privacy}","received_events_url":"https://api.github.com/users/takagi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/takagi/chainer","description":"A flexible framework of neural networks for deep learning","fork":true,"url":"https://api.github.com/repos/takagi/chainer","forks_url":"https://api.github.com/repos/takagi/chainer/forks","keys_url":"https://api.github.com/repos/takagi/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/takagi/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/takagi/chainer/teams","hooks_url":"https://api.github.com/repos/takagi/chainer/hooks","issue_events_url":"https://api.github.com/repos/takagi/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/takagi/chainer/events","assignees_url":"https://api.github.com/repos/takagi/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/takagi/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/takagi/chainer/tags","blobs_url":"https://api.github.com/repos/takagi/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/takagi/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/takagi/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/takagi/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/takagi/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/takagi/chainer/languages","stargazers_url":"https://api.github.com/repos/takagi/chainer/stargazers","contributors_url":"https://api.github.com/repos/takagi/chainer/contributors","subscribers_url":"https://api.github.com/repos/takagi/chainer/subscribers","subscription_url":"https://api.github.com/repos/takagi/chainer/subscription","commits_url":"https://api.github.com/repos/takagi/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/takagi/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/takagi/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/takagi/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/takagi/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/takagi/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/takagi/chainer/merges","archive_url":"https://api.github.com/repos/takagi/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/takagi/chainer/downloads","issues_url":"https://api.github.com/repos/takagi/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/takagi/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/takagi/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/takagi/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/takagi/chainer/labels{/name}","releases_url":"https://api.github.com/repos/takagi/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/takagi/chainer/deployments","created_at":"2016-02-18T10:13:12Z","updated_at":"2016-02-18T10:13:14Z","pushed_at":"2016-10-03T11:23:09Z","git_url":"git://github.com/takagi/chainer.git","ssh_url":"git@github.com:takagi/chainer.git","clone_url":"https://github.com/takagi/chainer.git","svn_url":"https://github.com/takagi/chainer","homepage":"http://chainer.org","size":12797,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pfnet:master","ref":"master","sha":"5dd7e0d1955b16766c2085a1cc4f42fc706c4385","user":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"repo":{"id":36914478,"name":"chainer","full_name":"pfnet/chainer","owner":{"login":"pfnet","id":9739572,"avatar_url":"https://avatars.githubusercontent.com/u/9739572?v=3","gravatar_id":"","url":"https://api.github.com/users/pfnet","html_url":"https://github.com/pfnet","followers_url":"https://api.github.com/users/pfnet/followers","following_url":"https://api.github.com/users/pfnet/following{/other_user}","gists_url":"https://api.github.com/users/pfnet/gists{/gist_id}","starred_url":"https://api.github.com/users/pfnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pfnet/subscriptions","organizations_url":"https://api.github.com/users/pfnet/orgs","repos_url":"https://api.github.com/users/pfnet/repos","events_url":"https://api.github.com/users/pfnet/events{/privacy}","received_events_url":"https://api.github.com/users/pfnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pfnet/chainer","description":"A flexible framework of neural networks for deep learning","fork":false,"url":"https://api.github.com/repos/pfnet/chainer","forks_url":"https://api.github.com/repos/pfnet/chainer/forks","keys_url":"https://api.github.com/repos/pfnet/chainer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pfnet/chainer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pfnet/chainer/teams","hooks_url":"https://api.github.com/repos/pfnet/chainer/hooks","issue_events_url":"https://api.github.com/repos/pfnet/chainer/issues/events{/number}","events_url":"https://api.github.com/repos/pfnet/chainer/events","assignees_url":"https://api.github.com/repos/pfnet/chainer/assignees{/user}","branches_url":"https://api.github.com/repos/pfnet/chainer/branches{/branch}","tags_url":"https://api.github.com/repos/pfnet/chainer/tags","blobs_url":"https://api.github.com/repos/pfnet/chainer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pfnet/chainer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pfnet/chainer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pfnet/chainer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pfnet/chainer/statuses/{sha}","languages_url":"https://api.github.com/repos/pfnet/chainer/languages","stargazers_url":"https://api.github.com/repos/pfnet/chainer/stargazers","contributors_url":"https://api.github.com/repos/pfnet/chainer/contributors","subscribers_url":"https://api.github.com/repos/pfnet/chainer/subscribers","subscription_url":"https://api.github.com/repos/pfnet/chainer/subscription","commits_url":"https://api.github.com/repos/pfnet/chainer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pfnet/chainer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pfnet/chainer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pfnet/chainer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pfnet/chainer/contents/{+path}","compare_url":"https://api.github.com/repos/pfnet/chainer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pfnet/chainer/merges","archive_url":"https://api.github.com/repos/pfnet/chainer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pfnet/chainer/downloads","issues_url":"https://api.github.com/repos/pfnet/chainer/issues{/number}","pulls_url":"https://api.github.com/repos/pfnet/chainer/pulls{/number}","milestones_url":"https://api.github.com/repos/pfnet/chainer/milestones{/number}","notifications_url":"https://api.github.com/repos/pfnet/chainer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pfnet/chainer/labels{/name}","releases_url":"https://api.github.com/repos/pfnet/chainer/releases{/id}","deployments_url":"https://api.github.com/repos/pfnet/chainer/deployments","created_at":"2015-06-05T05:50:37Z","updated_at":"2016-10-04T05:55:28Z","pushed_at":"2016-10-04T08:32:35Z","git_url":"git://github.com/pfnet/chainer.git","ssh_url":"git@github.com:pfnet/chainer.git","clone_url":"https://github.com/pfnet/chainer.git","svn_url":"https://github.com/pfnet/chainer","homepage":"http://chainer.org","size":32684,"stargazers_count":1685,"watchers_count":1685,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":421,"mirror_url":null,"open_issues_count":242,"forks":421,"open_issues":242,"watchers":1685,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1534"},"html":{"href":"https://github.com/pfnet/chainer/pull/1534"},"issue":{"href":"https://api.github.com/repos/pfnet/chainer/issues/1534"},"comments":{"href":"https://api.github.com/repos/pfnet/chainer/issues/1534/comments"},"review_comments":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1534/comments"},"review_comment":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pfnet/chainer/pulls/1534/commits"},"statuses":{"href":"https://api.github.com/repos/pfnet/chainer/statuses/b0a637ab19b3a5aca9e8c759fad2213ccde33e28"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"delta2323","id":407052,"avatar_url":"https://avatars.githubusercontent.com/u/407052?v=3","gravatar_id":"","url":"https://api.github.com/users/delta2323","html_url":"https://github.com/delta2323","followers_url":"https://api.github.com/users/delta2323/followers","following_url":"https://api.github.com/users/delta2323/following{/other_user}","gists_url":"https://api.github.com/users/delta2323/gists{/gist_id}","starred_url":"https://api.github.com/users/delta2323/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delta2323/subscriptions","organizations_url":"https://api.github.com/users/delta2323/orgs","repos_url":"https://api.github.com/users/delta2323/repos","events_url":"https://api.github.com/users/delta2323/events{/privacy}","received_events_url":"https://api.github.com/users/delta2323/received_events","type":"User","site_admin":false},"comments":15,"review_comments":44,"commits":35,"additions":234,"deletions":96,"changed_files":5}}
{"actor":{"display_login":"delta2323"}}