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

Reduce backward memory to ~half #218

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jasam-sheja
Copy link

@jasam-sheja jasam-sheja commented Dec 10, 2021

Reuse the grad and input tensors in the backward pass instead of creating new ones.
Mainly reuse y_act for xhat and dy_act for dy.
Ensure every function support in-place operation. (Elu is modified accordingly)
Ensure the tensors allow in-place operation (dy_act has to be contiguous)

Needs more testing. However, there are no unit tests.

- reuse y_act_ and dy_act_
- use inplace calculations in `forward_cpu` and `backward_cpu`
- make sure dy_act doesn't have memory overlaping
- reflect the inplace operations in the doc and comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants