Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the GRNN much slower than a GRU #272

Open
jambo6 opened this issue Nov 22, 2022 · 1 comment
Open

Why is the GRNN much slower than a GRU #272

jambo6 opened this issue Nov 22, 2022 · 1 comment

Comments

@jambo6
Copy link

jambo6 commented Nov 22, 2022

from torch import nn
from rnn import FastGRNNCUDA

x = torch.randn((8192, 4, 512)).cuda()
h0 = torch.zeros((4, 512)).cuda()
    
gru = nn.GRU(512, 512, batch_first=False).cuda()
grnn = FastGRNNCUDA(512, 512, batch_first=False).cuda()

Timing (with proper cuda synchronisation) gives a loop time of 0.1s for the GRU and 0.35s for the GRNN. Am I doing something wrong, surely the GRNN should be at least on par with the GRU since it is less operations.

@adityakusupati
Copy link
Contributor

Hi,

Thanks for the timing numbers. IIRC, I don't think we optimized GRNN to the level of inbuilt GRU and that shows evidently here. The speedups are obvious when you use GRU and GRNN from our own naive implementations.

Aditya

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

No branches or pull requests

2 participants