
patch mergingshift windows transformerh/4 * w/4 * C 이고, output은 h/8 * w/8 * 2C
W-MSASW-MSAW-MSA 만 표시했고, SW-MSA는 표시하지 않은 그림으로 추측됨


W-MSA)에서 self-attention 진행한 부분은, 중복 수행하지 않기 위해 masking을 수행합니다.W-MSA 던, SW-MSA 던), query와 key를 곱해서 attention score을 계산해야 함.attention score에 더해줌으로써, ViT의 posotional encoding을 대체하면서도, 성능을 높임.
relative position bias입니다.relative position bias은 relative position index와 learnable bias matrix을 통해 구해집니다.relative position indexM^2 by M^2의 관계가 형성됩니다. (attention score을 떠올리면 이해가 쉬워짐)M^2 by M^2 shape의 relative position index 입니다.
learnable bias matrixrelative position index의 각 셀의 값이 x,y Index이고, learnable bias matrix에서 그 x,y Index에 해당하는 값을 읽어서 곱해줍니다.