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

Push/Pull: use undefined tensors in backward pass when values not needed #18

Open
balbasty opened this issue Jun 19, 2020 · 0 comments
Open
Assignees
Labels
language: c++ Relates to C++/CUDA code performance Performance-related issue

Comments

@balbasty
Copy link
Owner

Currently, the backward passes of grid_push/grid_pull/etc require the forward input tensors as inputs even when the value they hold is not needed.

E.g., let the forward pass be grid_pull(image, grid), with image.requires_grad == True and grid.requires_grad == False. In that case, only grid is needed in the backward pass. However, the current implementation still requires image to be provided in order to know that its gradients are required and compute the output shape.

A better solution would be to provide an undefined tensor pseudo_image = torch.Tensor() with pseudo_image.requires_grad == True and pseudo_image.shape = image.shape + (0,).
(Or find another solution to specify the shape -> 0 batch dimension?)

@balbasty balbasty added performance Performance-related issue language: c++ Relates to C++/CUDA code labels Jun 19, 2020
@balbasty balbasty self-assigned this Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language: c++ Relates to C++/CUDA code performance Performance-related issue
Projects
None yet
Development

No branches or pull requests

1 participant