{"action":"opened","issue":{"url":"https://api.github.com/repos/salesforce/matchbox/issues/13","repository_url":"https://api.github.com/repos/salesforce/matchbox","labels_url":"https://api.github.com/repos/salesforce/matchbox/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/salesforce/matchbox/issues/13/comments","events_url":"https://api.github.com/repos/salesforce/matchbox/issues/13/events","html_url":"https://github.com/salesforce/matchbox/issues/13","id":325665807,"number":13,"title":"inner() missing 1 required positional argument: 'batch2'","user":{"login":"vlasenkov","id":13369474,"avatar_url":"https://avatars3.githubusercontent.com/u/13369474?v=4","gravatar_id":"","url":"https://api.github.com/users/vlasenkov","html_url":"https://github.com/vlasenkov","followers_url":"https://api.github.com/users/vlasenkov/followers","following_url":"https://api.github.com/users/vlasenkov/following{/other_user}","gists_url":"https://api.github.com/users/vlasenkov/gists{/gist_id}","starred_url":"https://api.github.com/users/vlasenkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlasenkov/subscriptions","organizations_url":"https://api.github.com/users/vlasenkov/orgs","repos_url":"https://api.github.com/users/vlasenkov/repos","events_url":"https://api.github.com/users/vlasenkov/events{/privacy}","received_events_url":"https://api.github.com/users/vlasenkov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-23T11:36:28Z","updated_at":"2018-05-23T11:36:28Z","closed_at":null,"author_association":"NONE","body":"Hi!  I'm trying to run a bidirectional GRU with masking. This fails with an error. Is it a bug?\r\n\r\nThe full script:\r\n```python\r\nimport torch\r\nfrom torch import nn\r\nimport matchbox\r\nfrom matchbox import MaskedBatch\r\nimport numpy as np\r\n\r\nclass BiGRU(nn.Module):\r\n    \r\n    def __init__(self, in_size, out_size):\r\n        super().__init__()\r\n        self.fcell = nn.GRUCell(in_size, out_size)\r\n        self.rcell = nn.GRUCell(in_size, out_size)\r\n\r\n    @matchbox.batch\r\n    def forward(self, x, h0=None):\r\n        hf = x.batch_zeros(self.fcell.hidden_size) if h0 is None else h0\r\n        print(hf.dtype)\r\n        for xt in x.unbind(1):\r\n            hf = self.fcell(xt, hf)\r\n        hr = x.batch_zeros(self.rcell.hidden_size) if h0 is None else h0\r\n        for xt in reversed(x.unbind(1)):\r\n            hr = self.rcell(xt, hr)\r\n        return hf, hr\r\n\r\nmodel = BiGRU(4, 5)\r\n\r\nx = MaskedBatch(\r\n    data=torch.rand((2, 3, 4)),\r\n    dims=(True, False),\r\n    mask=torch.tensor([\r\n        [1, 1, 1],\r\n        [1, 1, 0],\r\n    ], dtype=torch.float32)[:, :, np.newaxis]\r\n) \r\n\r\nmodel(x)\r\n```\r\nTraceback:\r\n```\r\nTraceback (most recent call last):\r\n  File \"test.py\", line 49, in <module>\r\n    model(x)\r\n  File \".../dl/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 491, in __call__\r\n    result = self.forward(*input, **kwargs)\r\n  File \"/tmp/tmpnu655rxr/matchbox_618c.py\", line 10, in forward\r\n    matchbox.MaskedBatch, matchbox.TENSOR_TYPE)) else self.fcell(xt, hf\r\n  File \".../dl/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 491, in __call__\r\n    result = self.forward(*input, **kwargs)\r\n  File \".../dl/lib/python3.6/site-packages/torch/nn/modules/rnn.py\", line 763, in forward\r\n    self.bias_ih, self.bias_hh,\r\n  File \".../dl/lib/python3.6/site-packages/torch/nn/_functions/rnn.py\", line 64, in GRUCell\r\n    hy = newgate + inputgate * (hidden - newgate)\r\n  File \".../matchbox/matchbox/functional/elementwise.py\", line85, in inner\r\n    return replacement(self, other)\r\n  File \".../matchbox/matchbox/functional/elementwise.py\", line90, in <lambda>\r\n    TENSOR_TYPE.__sub__ = _inject_arith(TENSOR_TYPE.__sub__, lambda a, b: -b + a)\r\nTypeError: inner() missing 1 required positional argument: 'batch2'\r\n```\r\n\r\nCloned the repo from master. Commit hash: d8ec78964b01cfe8ee9c23fb1adca4bae9145204."}}
{"actor":{"display_login":"vlasenkov"}}