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

Memory allocation for h_t and c_t #12

Open
hector1980 opened this issue Apr 15, 2020 · 0 comments
Open

Memory allocation for h_t and c_t #12

hector1980 opened this issue Apr 15, 2020 · 0 comments

Comments

@hector1980
Copy link

I think it would be a tiny bit faster if you allocate the whole memory for h_t and c_t from the beginning in OptimizedLSTM. I mean:

    if init_states is None:
        h_t, c_t = (torch.zeros(bs, self.hidden_size).to(x.device),
                    torch.zeros(bs, self.hidden_size).to(x.device))

instead of:

    if init_states is None:
        h_t, c_t = (torch.zeros(self.hidden_size).to(x.device),
                    torch.zeros(self.hidden_size).to(x.device))
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

1 participant