{"action":"created","issue":{"url":"https://api.github.com/repos/pfnet/chainer/issues/1794","repository_url":"https://api.github.com/repos/pfnet/chainer","labels_url":"https://api.github.com/repos/pfnet/chainer/issues/1794/labels{/name}","comments_url":"https://api.github.com/repos/pfnet/chainer/issues/1794/comments","events_url":"https://api.github.com/repos/pfnet/chainer/issues/1794/events","html_url":"https://github.com/pfnet/chainer/pull/1794","id":183921592,"number":1794,"title":"cupy matmul","user":{"login":"boeddeker","id":13744128,"avatar_url":"https://avatars.githubusercontent.com/u/13744128?v=3","gravatar_id":"","url":"https://api.github.com/users/boeddeker","html_url":"https://github.com/boeddeker","followers_url":"https://api.github.com/users/boeddeker/followers","following_url":"https://api.github.com/users/boeddeker/following{/other_user}","gists_url":"https://api.github.com/users/boeddeker/gists{/gist_id}","starred_url":"https://api.github.com/users/boeddeker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boeddeker/subscriptions","organizations_url":"https://api.github.com/users/boeddeker/orgs","repos_url":"https://api.github.com/users/boeddeker/repos","events_url":"https://api.github.com/users/boeddeker/events{/privacy}","received_events_url":"https://api.github.com/users/boeddeker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pfnet/chainer/labels/feature","name":"feature","color":"fbca04"}],"state":"open","locked":false,"assignee":{"login":"okuta","id":7133388,"avatar_url":"https://avatars.githubusercontent.com/u/7133388?v=3","gravatar_id":"","url":"https://api.github.com/users/okuta","html_url":"https://github.com/okuta","followers_url":"https://api.github.com/users/okuta/followers","following_url":"https://api.github.com/users/okuta/following{/other_user}","gists_url":"https://api.github.com/users/okuta/gists{/gist_id}","starred_url":"https://api.github.com/users/okuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okuta/subscriptions","organizations_url":"https://api.github.com/users/okuta/orgs","repos_url":"https://api.github.com/users/okuta/repos","events_url":"https://api.github.com/users/okuta/events{/privacy}","received_events_url":"https://api.github.com/users/okuta/received_events","type":"User","site_admin":false},"assignees":[{"login":"okuta","id":7133388,"avatar_url":"https://avatars.githubusercontent.com/u/7133388?v=3","gravatar_id":"","url":"https://api.github.com/users/okuta","html_url":"https://github.com/okuta","followers_url":"https://api.github.com/users/okuta/followers","following_url":"https://api.github.com/users/okuta/following{/other_user}","gists_url":"https://api.github.com/users/okuta/gists{/gist_id}","starred_url":"https://api.github.com/users/okuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okuta/subscriptions","organizations_url":"https://api.github.com/users/okuta/orgs","repos_url":"https://api.github.com/users/okuta/repos","events_url":"https://api.github.com/users/okuta/events{/privacy}","received_events_url":"https://api.github.com/users/okuta/received_events","type":"User","site_admin":false}],"milestone":null,"comments":7,"created_at":"2016-10-19T10:17:33Z","updated_at":"2016-10-26T02:26:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pfnet/chainer/pulls/1794","html_url":"https://github.com/pfnet/chainer/pull/1794","diff_url":"https://github.com/pfnet/chainer/pull/1794.diff","patch_url":"https://github.com/pfnet/chainer/pull/1794.patch"},"body":"A starting point for #1765.\r\n\r\nAnd an example starting Function:\r\n```\r\nclass MatMul(function.Function):\r\n\r\n    @property\r\n    def label(self):\r\n        return '_ @ _'\r\n\r\n    def check_type_forward(self, in_types):\r\n        type_check.expect(in_types.size() == 2)\r\n        if not in_types[0].value.dtype in (\r\n                numpy.float32, numpy.complex64, numpy.complex128):\r\n            raise TypeError(in_types[0].value.dtype)\r\n        assert in_types[1].value.dtype in (\r\n            numpy.float32, numpy.complex64, numpy.complex128)\r\n        type_check.expect(\r\n            in_types[0].ndim >= 2,\r\n            in_types[1].ndim >= 2,\r\n            in_types[0].shape[:-2] == in_types[1].shape[:-2],\r\n            in_types[0].shape[-1] == in_types[1].shape[-2],\r\n        )\r\n        # TODO: Allow complex64 combined with float32\r\n\r\n    def forward(self, x):\r\n        xp = cuda.get_array_module(*x)\r\n        if xp.isnan(x[0]).any():\r\n            print('fw x[0] is nan.')\r\n        if xp.isnan(x[1]).any():\r\n            print('fw x[1] is nan.')\r\n        result = utils.force_array(x[0] @ x[1])\r\n\r\n        if xp.isnan(result).any():\r\n            print('fw result is nan.')\r\n\r\n        return result,\r\n\r\n    def forward_cpu(self, inputs):\r\n        raise NotImplementedError()\r\n\r\n    def forward_gpu(self, inputs):\r\n        raise NotImplementedError()\r\n\r\n    def backward(self, x, gy):\r\n        grad_x_0_star = utils.force_array(gy[0] @ xp_hermitian(x[1]))\r\n        grad_x_1_star = utils.force_array(xp_hermitian(x[0]) @ gy[0])\r\n        return grad_x_0_star, grad_x_1_star\r\n```"},"comment":{"url":"https://api.github.com/repos/pfnet/chainer/issues/comments/256232988","html_url":"https://github.com/pfnet/chainer/pull/1794#issuecomment-256232988","issue_url":"https://api.github.com/repos/pfnet/chainer/issues/1794","id":256232988,"user":{"login":"okuta","id":7133388,"avatar_url":"https://avatars.githubusercontent.com/u/7133388?v=3","gravatar_id":"","url":"https://api.github.com/users/okuta","html_url":"https://github.com/okuta","followers_url":"https://api.github.com/users/okuta/followers","following_url":"https://api.github.com/users/okuta/following{/other_user}","gists_url":"https://api.github.com/users/okuta/gists{/gist_id}","starred_url":"https://api.github.com/users/okuta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/okuta/subscriptions","organizations_url":"https://api.github.com/users/okuta/orgs","repos_url":"https://api.github.com/users/okuta/repos","events_url":"https://api.github.com/users/okuta/events{/privacy}","received_events_url":"https://api.github.com/users/okuta/received_events","type":"User","site_admin":false},"created_at":"2016-10-26T02:26:02Z","updated_at":"2016-10-26T02:26:02Z","body":"> Should I add more comments to the code, to explain it or is the doc string meant?\r\nYes, please.\r\nhttps://github.com/pfnet/chainer/pull/1794/files#diff-bbf3a0eb10e36ef8cbbf71b7ea848af0R11\r\nPlease add docstring to `matmul`.\r\n\r\nsee also https://github.com/pfnet/chainer/pull/1794/files#diff-bbf3a0eb10e36ef8cbbf71b7ea848af0R14"}}
{"actor":{"display_login":"okuta"}}