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

Fix recurrent block memory leak and output shape calculation #556

Conversation

mpskowron
Copy link
Contributor

@mpskowron mpskowron commented Jan 24, 2021

Description

  1. Recurrent block implementation has a memory leak in opInputs(...) function, line 240:
    parameterList.add(array.flatten());
    array.flatten() is creating new array in model's NDManager, thus this array lives as long as the model. The analogical problem is also present in LSTM block.
  2. Recurrent block's getOutputShapes(...) function returns incorrect shapes. Block accepts NTC not TNC (which is wrongly assumed as input shape in getOutputShapes(...) function).

Copy link
Contributor

@stu1130 stu1130 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mpskowron Thanks for your contribution. I am also doing refactoring on the model to make it more generic for latter PyTorch & TensorFlow integration. So I am going to merge your PR and rebase onto it.

@mpskowron
Copy link
Contributor Author

Sounds great! Thank you guys for a quick review.

@stu1130 stu1130 merged commit 0b4f3a5 into deepjavalibrary:master Jan 25, 2021
Lokiiiiii pushed a commit to Lokiiiiii/djl that referenced this pull request Oct 10, 2023
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

Successfully merging this pull request may close these issues.

4 participants