{"url":"https://htn20190109.hatenablog.com/entry/2025/11/20/235639","description":"import torchimport torch.nn as nnimport math # ==============================# Scaled Dot-Product Attention# ==============================class ScaledDotProductAttention(nn.Module): def __init__(self, scale_factor): super().__init__() self.scale_factor = scale_factor def forward(self, q, k, v): dk \u2026","image_url":null,"author_name":"HTN20190109","author_url":"https://blog.hatena.ne.jp/HTN20190109/","blog_url":"https://htn20190109.hatenablog.com/","height":"190","blog_title":"HTN20190109\u306e\u65e5\u8a18","title":"TransformerBlock","categories":["DL"],"type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhtn20190109.hatenablog.com%2Fentry%2F2025%2F11%2F20%2F235639\" title=\"TransformerBlock - HTN20190109\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","provider_name":"Hatena Blog","width":"100%","version":"1.0","provider_url":"https://hatena.blog","published":"2025-11-20 23:56:39"}