but attention is applicable to images also, like here,

  
      github.com
  
  
    tengshaofeng/ResidualAttentionNetwork-pytorch/blob/master/Residual-Attention-Network/model/attention_module.py 215
import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.autograd import Variable
import numpy as np

from .basic_layers import ResidualBlock


class AttentionModule_pre(nn.Module):

    def __init__(self, in_channels, out_channels, size1, size2, size3):
        super(AttentionModule_pre, self).__init__()
        self.first_residual_blocks = ResidualBlock(in_channels, out_channels)

        self.trunk_branches = nn.Sequential(
            ResidualBlock(in_channels, out_channels),
            ResidualBlock(in_channels, out_channels)
         )


  This file has been truncated. show original

  
  
    
    
  
  


is nn.MultiheadAttention applicable for images?
I want neural network to focus on part of image, I think attention is doing something similar with text, focusing on some part of text.