Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Running GRUCell on GPU #17

Open
vlasenkov opened this issue May 24, 2018 · 3 comments
Open

Running GRUCell on GPU #17

vlasenkov opened this issue May 24, 2018 · 3 comments
Assignees

Comments

@vlasenkov
Copy link
Contributor

Tried to forward a MaskedBatch through a GRUCell on GPU. Got the following:

Traceback (most recent call last):
  File "bi_gru_test.py", line 110, in <module>
    res = model(x)
  File ".../dl/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/tmp/tmp7bd5sts_/matchbox_572f.py", line 9, in forward
    matchbox.MaskedBatch, matchbox.TENSOR_TYPE)) else self.fcell(xt, hf
  File ".../dl/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File ".../dl/lib/python3.6/site-packages/torch/nn/modules/rnn.py", line 763, in forward
    self.bias_ih, self.bias_hh,
  File ".../dl/lib/python3.6/site-packages/torch/nn/_functions/rnn.py", line 54, in GRUCell
    return state(gi, gh, hidden) if b_ih is None else state(gi, gh, hidden, b_ih, b_hh)
  File ".../dl/lib/python3.6/site-packages/torch/nn/_functions/thnn/rnnFusedPointwise.py", line 24, in forward
    input_gate, hidden_gate, ibias, hbias, hx, hy, workspace)
TypeError: CudaGRUFused_updateOutput received an invalid combination of arguments - got (int, MaskedBatch, Tensor, Tensor, Tensor, Tensor, Tensor, Tensor), but expected (int state, torch.cuda.FloatTensor input, torch.cuda.FloatTensor hidden, [torch.cuda.FloatTensor bias1 or None], [torch.cuda.FloatTensor bias2 or None], torch.cuda.FloatTensor hx, torch.cuda.FloatTensor hy, torch.cuda.FloatTensor storage)

Does it mean that matchbox requires another implementation of GRU for GPU? Is there some workarond?

@jekbradbury jekbradbury self-assigned this May 26, 2018
@jekbradbury
Copy link
Contributor

Yes, we will have to tell Matchbox that all of the rnnFusedPointwise ops are elementwise n-ary.

@vlasenkov
Copy link
Contributor Author

Does any layer/loss that makes calls to torch._C need to have an implementation in matchbox? This results in cloning torch's API. Is it possible to create some default wrapper for all such layers? It would just apply torch._C routines to MaskedBatch.data and return a new MaskedBatch.

@jekbradbury
Copy link
Contributor

jekbradbury commented May 26, 2018 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants