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

simplification of the sincos positional encoding in patchembedding.py #7605

Merged
merged 3 commits into from
Apr 4, 2024

Conversation

Lucas-rbnt
Copy link
Contributor

@Lucas-rbnt Lucas-rbnt commented Apr 2, 2024

Fixes #7564 .

Description

As discussed, a small simplification for the creation of sincos positional encoding where we don't need to use the torch.no_grad() context or copy the tensor with copy_ from torch which doesn't preserve the requires_grad attribute here.

The changes are simple and are linked to the corresponding comment #7564, the output is already in float32 so it doesn't seem particularly necessary to apply the conversion previously done.

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

Lucas-rbnt and others added 2 commits March 31, 2024 20:15
@Lucas-rbnt Lucas-rbnt changed the title refactoring the sincos positional encoding in patchembedding.py simplification of the sincos positional encoding in patchembedding.py Apr 2, 2024
Copy link
Contributor

@marksgraham marksgraham left a comment

Choose a reason for hiding this comment

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

LGTM

@KumoLiu
Copy link
Contributor

KumoLiu commented Apr 3, 2024

/build

1 similar comment
@KumoLiu
Copy link
Contributor

KumoLiu commented Apr 3, 2024

/build

@KumoLiu KumoLiu merged commit 195d7dd into Project-MONAI:dev Apr 4, 2024
28 checks passed
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.

None yet

3 participants