support scaled_dot_product_attention for swin

Open
#8,182 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python, pytorch

Research direction

Start by reading the Swin shifted_window_attention entry point and the referenced PyTorch issue about Tensor attn_mask support. Run the existing Swin attention or model tests, then verify that supported cases use scaled_dot_product_attention while preserving behavior for the limitation described.

Written by the indexing model from the issue text.

Description

🚀 The feature

support torch.nn.functional.scaled_dot_product_attention for shifted_window_attention in swin
https://github.com/pytorch/vision/pull/8183

Motivation, pitch

torch.nn.functional.scaled_dot_product_attention is much more efficient. if we use large size window size, we can get the benefit of runtime

Limitation

currently torch.nn.functional.scaled_dot_product_attention doesn't support Tensor type for attn_mask.

https://github.com/pytorch/pytorch/issues/116237

Alternatives

No response

Additional context

No response

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pytorch/vision

All issues in pytorch/vision

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.