# \_scaled\_dot\_product\_efficient\_attention implementation

**URL:** <https://discuss.pytorch.org/t/scaled-dot-product-efficient-attention-implementation/220407>\
**Category:** torch.package / torch::deploy\
**Created:** [May 28, 2025, 1:46pm UTC](https://discuss.pytorch.org/t/scaled-dot-product-efficient-attention-implementation/220407 "2025-05-28T13:46:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunava5764](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/arunava5764/32/77196_2.png) [@arunava5764](https://discuss.pytorch.org/u/arunava5764)\
**Post date:** [May 28, 2025, 1:46pm UTC](https://discuss.pytorch.org/t/scaled-dot-product-efficient-attention-implementation/220407/1 "2025-05-28T13:46:53Z")

</div>

I was profiling a ViT model using pytorch profiler. It shows “\_scaled\_dot\_product\_efficient\_attention” function called 12 times. I want to see the implementation of this function in pytorch github repo. The function name is mentioned in line no 766 of the following link:

> <https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/native/transformers/attention.cpp>

Also, in the same file the header file associated with this function is included in line no 40. But I cannot find any file where the function is implemented. Same goes for “\_efficient\_attention\_forward” function showing in the profiler output. Is there any way to see those implementation in pytorch github?
