Skip to content

Conversation

@markelsanz14
Copy link
Contributor

Depending on how the forward pass is implemented, grad_output in this function will not be contiguous, so it crashes when calling .view(). By adding this extra line, we ensure it's contiguous. And it's a no-op when it already is contiguous, so performance shouldn't suffer.

Depending on how the forward pass is implemented, grad_output in this function will not be contiguous, so it crashes when calling .view(). By adding this extra line, we ensure it's contiguous. And it's a no-op when it already is contiguous, so performance shouldn't sufffer.
Copy link
Collaborator

@crcrpar crcrpar left a comment

Choose a reason for hiding this comment

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

could you provide me with an example where grad_output is not contiguous?

@crcrpar crcrpar merged commit 95cea8e into NVIDIA:master Feb 28, 2023
@crcrpar crcrpar added this to the 23.03 milestone Feb 28, 2023
yuanzhedong pushed a commit to yuanzhedong/apex that referenced this pull request Jul 14, 2023
Depending on how the forward pass is implemented, grad_output in this function will not be contiguous, so it crashes when calling .view(). By adding this extra line, we ensure it's contiguous. And it's a no-op when it already is contiguous, so performance shouldn't sufffer.
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.

2 participants